akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    private static final StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int k = readInt();
        int n = 7;
        for (int i = 0; i < 100000000; i++) {
            if (n % k == 0) {
                System.out.print(i + 1);
                return;
            }

            n = (n % k) * 10 + 7;
        }

        System.out.print(-1);

    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static double readDouble() {
        read();
        return Double.parseDouble(builder.toString());
    }

    private static BigDecimal readBigDecimal() {
        read();
        return new BigDecimal(builder.toString());
    }

    private static float readFloat() {
        read();
        return Float.parseFloat(builder.toString());
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


Measured memory_bytes: 32196
s = list(input())
#print(s)

l = []

for i in range(4):
  if not s[i] in l:
    l.append(s[i])
#print(l)

if len(l) != 2:
  print("No")
else:
  if s.count(l[0]) == 2:
    print("Yes")
  else:
    print("No")

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

int main() {
  string S;
  int K;
  cin >> S >> K;
  
  int count = 0;
  char num = '1';
  while (num == '1' && count < K) {
    num = S.at(count);
    count++;
  }
  
  if (K < count)
    cout << '1' << endl;
  else
    cout << num << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  while(cin>>n,n){
    string s[n+1];
    getline(cin,s[0]);
    for(int i=0;i<n;i++)getline(cin,s[i]);
    cin>>s[n];
    int pp=0;
    map<string,int>m;
    for(int i=0;i<n;i++){
      string t;
      for(int j=0;j<s[i].size();j++){
        if(s[i][j]!=' '&&s[i][j]!='\n')t+=s[i][j];
        else{
          if(t[0]==s[n][0]){
            pp=max(pp,(int)t.size());
            m[t]++;
            t="";
          }
          t="";
        }
          if(j==s[i].size()-1){
            if(!isalpha(t[t.size()-1]))t.erase(t.end()-1);
            if(t[0]==s[n][0]){
            pp=max(pp,(int)t.size());
            m[t]++;
            t="";
          }
        }
      }
    }
    vector<pair<int,string> >v;
    for(map<string,int>::iterator i=m.begin();i!=m.end();i++){
      string t=(*i).first,tt;
      int r=(*i).second,o=(int)t.size()-pp;
      while((int)t.size()<pp)t=t+'@';//cout<<t<<endl;
      v.push_back(make_pair(-r,t));
    }
    sort(v.begin(),v.end());

    //stable_sort(v1.begin(),v1.end());
    if(v.size()==0)cout<<"NA";
    else for(int i=0,k=0;i<v.size();i++,k++){
      if(k==5)break;
      if(i)cout<<' ';
      for(int j=0;j<v[i].second.size();j++)
        if(v[i].second[j]!='@')cout<<v[i].second[j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
struct compare
{
    bool operator()(const string& first, const string& second)
    {
        return first.size()>second.size();
    }
};
void solve()
{
    int n; string s;
    cin>>n>>s;
    if(n<3200) cout<<"red"<<endl;
    else cout<<s<<endl;
}

int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();

    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define EPS 1e-7
typedef pair<double,double> point, circle;

void intrsc( const circle &c1, const circle &c2, vector<point> &v ){
	double a,b,c,d,e,f,g,D;
	double x1,x2,y1,y2,ix1,ix2,iy1,iy2;

	x1 = c1.first;
	x2 = c2.first;
	y1 = c1.second;
	y2 = c2.second;

	a = x1*x1 - x2*x2 + y1*y1 - y2*y2;
	b = 2.0 * ( y1 - y2 );
	c = 2.0 * ( x1 - x2 );
	
	d = b*b + c*c;
	e = b*c*y1 - a*c - b*b*x1;
	f = b*b*(x1*x1 + y1*y1 - 1.0) + a*a - 2*a*b*y1;

	D = e*e - d*f;
	if( D >= 0 ){
		if( abs(d) < EPS ){
			v.push_back( point( x1 + 1.0, y1 ) );
			return;
		}
		g = sqrt(D);
		ix1 = ( -e + g ) / d;
		ix2 = ( -e - g ) / d;
		if( abs(b) < EPS ){
			iy1 = sqrt( 1.0 - (ix1-x1)*(ix1-x1) );
			iy2 = y1 - iy1;
			iy1 += y1;
		}
		else{
			iy1 = ( a - c * ix1 ) / b;
			iy2 = ( a - c * ix2 ) / b;
		}
		v.push_back( point( ix1, iy1 ) );
		v.push_back( point( ix2, iy2 ) );
	}
}

inline bool in( const point &p, const circle &c ){
	return	(p.first-c.first)*(p.first-c.first) +
			(p.second-c.second)*(p.second-c.second) <= 1.0+EPS;
}

int main(){
	int n;
	double x,y;
	for(; scanf("%d",&n),n; ){
		vector<point> v;
		vector<circle> crcl(n);
		for(int i = 0; i < n; i++ ){
			scanf("%lf,%lf",&x,&y);
			crcl[i] = circle(x,y);
		}

		for(int i = 0; i < n - 1; i++ )
			for(int j = i + 1; j < n; j++ )
				intrsc( crcl[i], crcl[j], v );

/*for(vector<point>::iterator it=v.begin();it!=v.end();++it){
	printf("\t%f\t%f\n",it->first,it->second);
}*/

		int m = 1;
		for( vector<point>::iterator p_it = v.begin();
				p_it != v.end(); ++p_it ){
			int cnt = 0;
			for( vector<circle>::iterator it = crcl.begin();
					it != crcl.end(); ++it ){
				if( in( *p_it, *it ) )	cnt++;
			}
			m = max( m, cnt );
		}
		printf("%d\n",m);
	}
}

Measured memory_bytes: 0
n, m = map(int, input().split())

arrs = []

for _ in range(n):
    vector = list(map(int, input().split()))
    arrs.append(vector)

vector = []
for _ in range(m):
    scalar = int(input())
    vector.append(scalar)

for arr in arrs:
    c = 0
    for i in range(len(arr)):
        c += arr[i] * vector[i]
    print(c)
        


Measured memory_bytes: 6012
#include<bits/stdc++.h>
#define rush() int T;scanf("%d",&T);int kase=1;while(T--)
#define all(x) (x).begin(),(x).End()
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define pb(x) push_back(x)
#define mem(a) memset(a,0,sizeof(a))
using namespace std;
using std::bitset;
typedef long long ll;
const ll maxn=1e6+5;
const ll mod=998244353;
const ll INF=0x3f3f3f3f3f3f3f3f;
const long double PI=acos(-1.0);
const long double eps=1e-5;
inline ll read(){ll ans=0,flag=1;char c;c=getchar();while(c<'0' || c>'9'){if(c=='-')flag=-1;c=getchar();}while(c>='0' && c<='9'){ans=ans*10+(ll)(c-'0');c=getchar();}return ans*flag;}
ll quickpow(ll x,ll y,ll mod){ll ans=1;while(y){if(y&1)ans=ans*x%mod;x=x*x%mod;y>>=1;}return ans;}

double a[200005];

int main()
{
    int n,k;
    cin>>n>>k;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a[i]=(x+1.0)/2.0;
    }
    for(int i=1;i<n;i++)
    {
        a[i]=a[i]+a[i-1];
    }
    double ans=a[k-1];
    for(int i=1;k+i-1<n;i++)
    {
        double t=a[k+i-1]-a[i-1];
        if(t>ans)
            ans=t;
    }
    printf("%.12lf\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int bitcnt(unsigned int x) {
    x = (x & 0x55555555) + (x >> 1 & 0x55555555);
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
    x = (x & 0x00ff00ff) + (x >> 8 & 0x00ff00ff);
    x = (x & 0x0000ffff) + (x >> 16 & 0x0000ffff);
    return (int)x;
}

vi f(int n, int a, int b) {
    if (n == 1) {
        RT vi{ a,b };
    }
    int C = 1 << (n - 1);
    if ((a&C) != (b&C)) {
        vi u = f(n - 1, a, a^1);
        vi v = f(n - 1, a ^ 1 ^ C, b);
        u.insert(u.end(), all(v));
        RT u;
    } else {
        vi u = f(n - 1, a, b);
        vi v = f(n - 1, a^C, u[1] ^ C);
        u.insert(u.begin() + 1, all(v));
        RT u;
    }
}

void solve() {
    int N, A, B;
    cin >> N >> A >> B;

    if (bitcnt(A) % 2 == bitcnt(B) % 2) {
        cout << "NO" << endl;
        return;
    }

    cout << "YES" << endl;
    vi ans = f(N, A, B);
    rep(i, 1 << N)cout << ans[i] << (i != (1 << N) - 1 ? ' ' : '\n');
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 1648
#!/usr/bin/env python3
import sys
import math


def solve(N: int):
    return math.ceil(N/2)

# Generated by 1.1.6 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()
    N = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()


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

int main(){
  int n,i;
  cin >> n;
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  
  ll h,w;
  h=0;
  w=0;
  for(i=n-1;i>=1;i--){
    if(a.at(i)==a.at(i-1)){
      if(h==0){
        h=a.at(i);
        i--;
      }else{
        w=a.at(i);
        goto out;
      }
    }
  }
  
  out:
  cout << h*w << endl;
}

Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
    ll i,j;
    ll n,m;
    cin>>n>>m;
    vector<P> v;

    for(i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        v.pb(P(b,a));
    }

    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());

    set<ll> se;
    for(i=0;i<=m;i++){
        se.insert(i);
    }
    ll ans=0;
    for(i=0;i<n;i++){
        ll x=v[i].se;
        if(se.lower_bound(x)!=se.end()){
            ans+=v[i].fi;
            se.erase(se.lower_bound(x));
        }
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 6512
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define ItsFun ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007



int main(){
	ItsFun;

	double d, t, s;cin >> d >> t >> s;

	double rt = d/s;

	 cout << (rt <= t ? "Yes" : "No" )<< "\n";

	return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
 
#define ll unsigned long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007
#define inf 9999999999999999ll
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h,a;
    cin>>h>>a;
    ll ans=(h+a-1)/a;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i,j;
	ll a,b,n;
	cin>>a>>b>>n;
	ll x=min(b-1,n);
	cout<<(a*x)/b-a*(x/b)<<endl;

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define dbgi(x) cout << #x << " = " << (x) << "\n";
#define dbgvi(x) cout << #x << " = "; for(int i = 0; i < (x.size()); ++i) cout << x[i] << " ";
#define mrk() cout << "HERE\n"
#define vi vector < int >
#define vs vector < string >
#define vii vector < vi >
#define viii vector < vii >
#define viiii vector < viii >
#define pii pair < int, int >
#define vpii vector < pii >
#define foru(i, a, b) for(int i = a; i < b; ++i)
#define ford(i, b, a) for(int i = b; i > a; --i)
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ld long double
using namespace std;

signed main(){
    int n;
    cin >> n;
    vi a(n + 1);
    foru(i, 1, n + 1)cin >> a[i];
    vi odd;
    vi even;
    foru(i, 1, n + 1){
        if(i % 2){
            odd.push_back(a[i]);
        } else {
            even.push_back(a[i]);
        }
    }
    if(n % 2 == 0){
        reverse(even.begin(), even.end());
        foru(i, 0, even.size()){
            cout << even[i] << " ";
        }
        foru(i, 0, odd.size()){
            cout << odd[i] << " ";
        }
    } else {
        reverse(odd.begin(), odd.end());
        foru(i, 0, odd.size()){
            cout << odd[i] << " ";
        }
        foru(i, 0, even.size()){
            cout << even[i] << " ";
        }
    }
}


Measured memory_bytes: 3956
s=input()
n=len(s)
for i in range(n):
    if not s[i]==s[n-1-i]:
        print('No')
        quit()
for i in range((n-1)//2):
    if not s[i]==s[(n-1)//2-1-i]:
        print('No')
        quit()
for i in range((n-1)//2):
    if not s[(n+3)//2-1+i]==s[n-1-i]:
        print('No')
        quit()
print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

_LL sub(_LL i, _LL k, _LL count, _LL left, _LL *tmp)
{
    _LL tmpsum = 0;
    if( left == 0 ) return 0;
    _LL maxleft = tmp[0];
    _LL seqcount = 0;
    for(int j = 0; j < 2 * count; j++ )
    {
        if( seqcount >= left )
        {
            tmpsum = tmpsum - tmp[(j - left) % count] + tmp[j % count];
            seqcount = left;
        }
        else
        {
            tmpsum += tmp[j % count];
            seqcount++;
        }
        maxleft = max(maxleft, tmpsum);
        
        if( tmpsum < 0 ) 
        {
            tmpsum = 0;
            seqcount = 0;
        }

    }    
    return maxleft;
}

int main()
{
    _LL n, k;
    cin >> n >> k;
    int *p = new int[n];
    _LL *c = new _LL[n];
    int *group = new int[n];
    _LL *tmp = new _LL[n];
    rep(i, n) 
    {
        cin >> p[i];
        p[i]--;
    }
    rep(i, n) cin >> c[i];
    rep(i, n) group[i] = -1;

    _LL ans = 0;
    bool init = true;

    rep(i, n)
    {
        if( group[i] >= 0 ) continue;

        _LL total = 0;
        _LL count = 0;
        int t = i;
        do
        {
            group[t] = i;
            total += c[t];
            tmp[count++] = c[t];
            t = p[t];
        } while( t != i );

        _LL left = k % count;
        _LL maxleft = sub(i, k, count, left, tmp);

        _LL groupans = max(total * (k / count) + maxleft, sub(i, k, count, min(k, count), tmp));
        if( k / count > 1 ) groupans = max(groupans, total * (k / count - 1) + sub(i, k, count, count, tmp) );

        if( init )
        {
            ans = groupans;
            init = false;
        }
        else
        {
            ans = max(ans, groupans);
        }
    }
    cout << ans;
    
    return 0;    
}

Measured memory_bytes: 3744
#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 FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(n-1+m),b(n-1+m);
    rep(i,n-1+m) {
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
    }
    
    vector<vector<int>> graph(n);
    vector<int> deg(n,0);
    rep(i,n-1+m){
        graph[b[i]].push_back(a[i]);
        deg[a[i]]++;
    }
    
    queue<int> q;
    rep(i,n) if(deg[i]==0) q.push(i);
    
    vector<int> vec(n); //vec[i] -> 頂点iのsort後のindex
    int cnt=n-1;
    while(!q.empty()){
        int v=q.front(); q.pop();
        vec[v]=cnt; cnt--;
        
        for(auto nv:graph[v]){
            deg[nv]--;
            if(deg[nv]==0) q.push(nv);
        }
        
    }
    
    rep(i,n){
        int ans=-1;
        int MAX=-1;
        for(int x:graph[i]){
            if(vec[x]>MAX){
                MAX=vec[x];
                ans=x;
            }
        }
        cout<<ans+1<<endl;
    }
}


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

int main(void)
{
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }
    
    double sum = 0;
    int calc = 0;
    for (int i = 0; i < N; ++i) {
        for (int k = i; k < N; ++k)
        {
            if (i == k) continue;
            int xs = x[i] - x[k];
            int ys = y[i] - y[k];
            sum += sqrt(xs * xs + ys * ys);
            calc++;
        }
    }
    cout << std::setprecision(24) << sum * 2 / N << endl;
}


Measured memory_bytes: 256
# machigatta 
class cmbs(object):
    def __init__(self, mod):
        self.mod = mod
        self.g1 = [1, 1]
        self.g2 = [1, 1]
        self.inverse = [0, 1]
        for i in range(2, 10 ** 6 + 1):
            self.g1.append((self.g1[-1] * i) % mod)
            self.inverse.append((-self.inverse[mod % i] * (mod // i)) % mod)
            self.g2.append((self.g2[-1] * self.inverse[-1]) % mod)

    def cmb(self, n, r):
        if n > 10 ** 6:
            return self.cmbl(n, r)
        return self.cmbr(n, r)

    def cmbr(self, n, r):
        if r < 0 or r > n:
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n-r] % self.mod

    def cmbl(self, n, r):
        t = 1
        r = min(r, n-r)
        for i in range(n - r + 1, n + 1):
            t = t * i % self.mod
        return t * self.g2[r] % self.mod

def main():
    N, M, K = map(int, input().split())
    mod = 10**9 + 7
    c = cmbs(mod)
    r = c.cmb((N*M)-2, K-2)
    r2 = 0
    for i in range(N):
        r2 += ((i + 1) * i + (N - i - 1) * (N-i))
    r2 *= pow(M, 2, mod)
    r2 %= mod
    r3 = 0
    for i in range(M):
        r3 += ((i + 1) * i + (M - i - 1) * (M-i))
    r3 *= pow(N, 2, mod)
    r3 %= mod
    r = r * (r2 + r3) * c.inverse[4]#// 2
    return r % mod
print(main())


Measured memory_bytes: 128196
// #B
// atcoder Mujin Programming Challenge 2017 main.go
// Thanks to https://atcoder.jp/img/mujin-pc-2017/editorial.pdf
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func solveEasy(arr [][]bool, iRank, jjRank []int) int {
	pi, pjj := 0, 0
	valueMaxi := -1
	posMaxi := []int{}
	for i := range iRank {
		if iRank[i] == len(iRank) {
			pi++
		}
		if iRank[i] == valueMaxi {
			posMaxi = append(posMaxi, i)
		} else if iRank[i] > valueMaxi {
			posMaxi = []int{i}
			valueMaxi = iRank[i]
		}
		if jjRank[i] == len(jjRank) {
			pjj++
		}
	}
	temp := 1
	for t := range arr {
		for _, k := range posMaxi {
			if arr[t][k] == true {
				temp = 0
			}
		}
	}
	return len(arr) - valueMaxi + len(arr) - pjj + temp
}

func solve(in io.Reader, out, err io.Writer) {
	N := 0
	tempString := ""
	count, ans := 0, 0

	fmt.Fscan(in, &N)
	arr := make([][]bool, N)
	iRank := make([]int, len(arr))
	jjRank := make([]int, len(arr))

	for i := range arr {
		arr[i] = make([]bool, N)
		fmt.Fscan(in, &tempString)

		for jj := range tempString {
			if tempString[jj] == '#' {
				arr[i][jj] = true
				count++
				iRank[i]++
				jjRank[jj]++
			}
		}
	}

	if count == N*N {
		fmt.Fprintln(out, 0)
		return
	}
	if count == 0 {
		fmt.Fprintln(out, -1)
		return
	}
	ans = solveEasy(arr, iRank, jjRank)

	fmt.Fprintln(out, ans)
}

func main() {
	br := bufio.NewReaderSize(os.Stdin, int(1e7))
	solve(br, os.Stdout, os.Stderr)
}


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


int main() {

    string s;
    
    cin >> s;

    int q; cin >>q;
    
    int tmp;
    string tm;

    int r_flag=0;
    for (int i=0;i<q;i++){
        cin >> tmp;

        if(tmp==1){
            r_flag +=1;
        } else {
            cin >> tmp;
            cin >> tm;
            if((tmp ==1 && r_flag%2==0) || (tmp == 2 && r_flag%2!=0)){
                s.insert(0,tm);
            }else{
                s.append(tm);
            }
        }
    }

    if(r_flag%2!=0){
        reverse(s.begin(), s.end());
    }

    cout << s << endl;
    
}

Measured memory_bytes: 900
C = [[0]*3]*3
for i in range(3):
    C[i] = list(map(int,input().split()))
ans = 'Yes'
for i in range(3):
    j = (i+1)%3
    if C[i][0] - C[j][0] == C[i][1] - C[j][1] and C[i][1] - C[j][1] == C[i][2] - C[j][2]:
        pass
    else:
        ans = 'No'
for i in range(3):
    j = (i+1)%3
    if C[0][i] - C[0][j] == C[1][i] - C[1][j] and C[1][i] - C[1][j] == C[2][i] - C[2][j]:
        pass
    else:
        ans = 'No'
print(ans)

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

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

    int N;
    cin >> N;

    int D;
    int E;
    int zoro_sum = 0;
    string ans = "No";

    for(int i =0; i < N; i++){
        cin >> D >> E;
        if(D == E){
            zoro_sum += 1;
        }
        else if(zoro_sum > 0){
            zoro_sum = 0;
        }

        if(zoro_sum == 3){
            ans = "Yes";
        }

    }

    cout << ans << endl;


    
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
using namespace std;

void sieve(int n, list<int> &primes)
{
    vector<bool> v(n + 1, true);

    // check
    for (int i = 3, end = sqrt(n); i <= end; i += 2) {
        if (!v[i])
            continue;
        for (int j = i * i, skip = i * 2; j <= n; j += skip)
            v[j] = false;
    }

    primes.push_back(2);
    for (int i = 3; i <= n; i += 2)
         if (v[i])
            primes.push_back(i);
}

int main()
{
    list<int> primes;
    vector<int> inputs;

    // read all inputs
    for (int x; cin >> x;)
        inputs.push_back(x);

    // init sieve
    sieve(*max_element(inputs.begin(), inputs.end()), primes);

    for (auto x : inputs) {
        int count = 0;
        for (auto p : primes) // find
            if (p == x) {
                count++;
                break;
            } else if (p > x)
                break;
            else
                count++;
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 3788
//
//AtCoder Beginner Contest 110
//C
//https://atcoder.jp/contests/abc110/tasks/abc110_c
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    string s, t;
    cin >> s >> t;

    vector<int> sCnt(26, 0);
    vector<int> tCnt(26, 0);
    REP(i, s.size()){
        sCnt[s[i]-'a']++;
        tCnt[t[i]-'a']++;
    }
    sort(ALL(sCnt));
    sort(ALL(tCnt));
    
    REP(i, sCnt.size()){
        if (sCnt[i]!=tCnt[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl; 
    return 0;
}


Measured memory_bytes: 3912
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args){
        int N = in.i();
        int[] prime = new int[N];
        int size = 0;
        prime[size++] = 2;
        for(int i = 3, k = 0; i < N; i++){
            boolean b = true;
            if(prime[k]*prime[k] < i) k++; 
            for(int j = 0; j <= k; j++){
                if(i%prime[j] == 0){
                    b = false;
                    break;             
                }
            } if(b) prime[size++] = i;
        }

        int[] count = new int[size];
        for(int i = 0; i < count.length; i++){
            int j = 0;
            int p = prime[i];
            int tmp = 0;
            while(p < N){
                tmp += N/p;
                p *= prime[i];
                j++;
            }
            count[i] = tmp;
        }

        int ans = 0;

        for(int i = 0; 74 <= count[i]; i++) ans++;

        for(int i = 0; 24 <= count[i]; i++)
            for(int j = 0; 2 <= count[j]; j++)
                if(i == j) continue;
                else ans++;               

        for(int i = 0; 14 <= count[i]; i++)
            for(int j = 0; 4 <= count[j]; j++)
                if(i == j) continue;
                else ans++;

        for(int i = 0; 4 <= count[i]; i++)
            for(int j = i+1; 4 <= count[j]; j++)
                for(int k = 0; 2 <= count[k]; k++)
                    if(k == i || j == k) continue;
                    else ans++;

        out.println(ans);
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 23252
#include<stdio.h>


int main(void)
{
	int n,x,i,j,k,sum;

	while(1){
		sum = 0;
		scanf("%d %d",&n, &x);
		if(n == 0 && x == 0)break;
		else{
			for(i = 1;i <= n;i++){
				for(j = i + 1;j <= n;j++){
					for(k = j + 1;k <= n;k++){
						if(i + j + k == x){
							sum++;
						}
					}
				}
			}
			printf("%d\n",sum);
		}
	}
	return 0;
}

Measured memory_bytes: 600
//{{{ #include <bits/stdc++.h>
#ifndef __clang__
#include <bits/stdc++.h>
#endif
using namespace std; //}}}
const long long MOD = static_cast<int>(1e9) + 7;
//{{{TEMPLATE_BEGIN
#include <unistd.h>
using namespace std::rel_ops;
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;
typedef vector<int> vint;
#define rep(i, n)                                                              \
    for (int i = 0, i##_len = static_cast<int>(n); i < i##_len; i++)
#define all(c) begin(c), end(c)
#define perm(c)                                                                \
    sort(all(c));                                                              \
for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))
#define uniquenize(v) (v).erase(unique(all(v)), end(v))
#define cauto const auto &
#define memset(x, y) memset(x, y, sizeof(x))
#define popcount __builtin_popcount
#define gcd __gcd
inline lint bit(int x) {
    return 1LL << x;
}
template <class T>
inline int size(const T &a) {
    return (int)a.size();
}
template <class T>
inline bool chmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}
template <class T>
inline int clamp(T v, T lo, T hi) {
    return (v > hi) - (v < lo);
}
template <class T>
inline bool chmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}
template <class T>
inline pair<vector<T>, char> operator*(const vector<T> &v, const char &c) {
    return make_pair(v, c);
}
template <class T>
inline istream &operator>>(istream &is, vector<T> &v) {
#ifdef ZEROKUGI
    if (v.empty()) {
        cerr << "Error L" << __LINE__ << ": vector size is zero." << endl;
        exit(EXIT_FAILURE);
    }
#endif
    for (auto &x : v)
        is >> x;
    return is;
}
template <class T>
inline ostream &operator<<(ostream &os, const pair<vector<T>, char> &v) {
    bool t = 0;
    for (const T &x : v.first) {
        if (t)
            os << v.second;
        os << x;
        t = 1;
    }
    return os;
}
template <class T>
inline ostream &operator<<(ostream &os, vector<T> &v) {
    return os << v * ' ';
}
struct before_main {
    before_main() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} __before_main;
//}}}TEMPLATE_END

int main() {
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;

    int ans = 0;
    rep(i, n) {
        if(a[i] != b[i] && b[i] != c[i] && c[i] != a[i]) ans += 2;
        else if(a[i] == b[i] && b[i] == c[i]) ans += 0;
        else ans += 1;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int two_gcd(int x, int y){
	if(y == 0) return x;
  	
  	return two_gcd(y,x % y); 
}

int gcd(int a,int b,int c){
  int d;
  
  d = two_gcd(a, b);
  
  return two_gcd(d, c);
}

int main(void){
  int K;
  int total;
  
  cin >> K;
  
  total = 0;
  for(int a = 1;a <= K;a++){
    for(int b = 1;b <= K;b++){
      for(int c = 1;c <= K;c++){
      	total += gcd(a, b, c);
      }
    }
  }
  
  cout << total << endl;
  
  return 0;
}

Measured memory_bytes: 3628
=begin
－－－－－－－－－－－－－－ 
A = 100*A 水
B = 100*B 水
C,D = １回の投入可能砂糖量
E = 100(g)あたりに溶かすことのできる砂糖量
F = ビーカー許容量(水 + 砂糖 = 総質量)
sugar = F 質量内でできる砂糖の質量を格納(Ci + Dj を組み合わせてできる質量の列挙)
water = F 質量内でできる水の質量を格納(100Ai + 100Bjの組み合わせでできる質量の列挙)
sum = water[i]とsugar[j]の総質量
pos = water[i] に溶かせる砂糖量
con = sugar[j]*100 / (sugar[j] + water[i])  の砂糖濃度(%)
ans = 答え
－－－－－－－－－－－－－－
=end

A,B,C,D,E,F = gets.split.map(&:to_i);

water = [];
(0..30).each do |i|
  (0..30).each do |j|
    x = (100*A*i) + (100*B*j);
    water << x if x <= F;
  end
end
# water.sort!.uniq!;

sugar = []
(0..100).each do |i|
  (0..100).each do |j|
    y = C * i + D * j;
    sugar << y if y <= F;
  end
end
# sugar.sort!.uniq!;

sum_ans = 0;
sugar_ans = 0;
dif = -1;
con = 0.0;

water.each do |w|
  sugar.each do |s|
    sum = w + s;
    pos = w / 100 * E;
    next if pos < s || F < sum

    con = (s*100) / (s + w).to_f;
    if dif < con
      sum_ans = sum;
      sugar_ans = s;
      dif = con;
    end
  end
end

puts "#{sum_ans} #{sugar_ans}"

Measured memory_bytes: 1916
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n,k;
    cin >> n >> k;
    vector<int> a(n),num(n+1,0);
    set<int> check;
    for(auto &x:a){
        cin >> x;
        check.insert(x);
        num[x]++;
    }

    int kind=check.size();
    if(kind<=k){
        cout << 0 << endl;
        return 0;
    }

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

    int i=0,ans=0;
    while(kind>k){
        if(num[i]==0){
            i++;
            continue;
        }
        kind--;
        ans+=num[i];
        i++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 14196
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

bool isMonth(int v) {
	return v > 0 && v <= 12;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;

	int a = (s[0] - '0') * 10 + s[1] - '0', b = (s[2] - '0') * 10 + s[3] - '0';
	
	bool f1 = isMonth(a), f2 = isMonth(b);
	if (f1 && f2)
		cout << "AMBIGUOUS" << endl;
	else if (f1)
		cout << "MMYY" << endl;
	else if (f2)
		cout << "YYMM" << endl;
	else
		cout << "NA" << endl;

	return 0;
}

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC   
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

const ll MOD = (ll)1e9+7; //change it for other mods

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve(ll testnum)
{
    ll a;
    cin >> a;
    cout << a + a*a + a*a*a << "\n";
}

int main()
{
    FAST_IO;
    #ifdef STIO 
      freopen("input.txt" , "r", stdin);
      freopen("output.txt" , "w", stdout);
    #endif
    ll t = 1;
    // cin >> t;
    for (ll i = 1; i <= t; i++) {
        solve(i);
    }
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(a < b && b < c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

int main(void)
{
	int a,b,c[10000],i,n;
	char op;
	i=1;
	scanf("%d %c %d",&a,&op,&b);
	while(op!='?'){
		if(op=='+'){
			c[i]=a+b;
		}
		if(op=='-'){
			c[i]=a-b;
		}
		if(op=='*'){
			c[i]=a*b;
		}
		if(op=='/'){
			c[i]=a/b;
		}
		i++;
		scanf("%d %c %d",&a,&op,&b);
	}
	n=i;
	for(i=1;i<=n-1;i++){
			printf("%d\n",c[i]);
	}
	return 0;
}


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

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1000000007;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;


void solve(){

    int n;
    cin>>n;
    cout<<((n==1)?0:1)<<"\n";

}


int main(){
    fast
    // #ifndef godzqa
    //     io
    // #endif

    lli t;
    // cin>>t;
    t=1;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
main(){
  int n ,T ,mi = 5000;
  cin >> n >> T;for(register int i = 0 ,c ,t; i < n; i++){cin>>c>>t;t<=T?mi=min(mi,c):mi=mi;}if(mi==5000)cout<<"TLE";else cout<<mi;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define debug(x) cout << x << endl
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const LL INF64 = 1e18;

const int N = 1e5 + 5;

int main() {
	fastio;
	LL a, b;
	cin >> a >> b;
	LL mx = max(a, b);
	if (a == b)
		cout << a + b << endl;
	else 
		cout << mx + mx - 1 << endl;
	return 0;
}
		

Measured memory_bytes: 256
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    N = I()
    A = LI()
    res = [0]*N
    for i, a in zip(range(N), A):
        res[a-1] += 1
    for i in range(N):
        print(res[i])

if __name__ == '__main__':
    main()

Measured memory_bytes: 33848
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

long long process(long long n)
{
	return n * n * n * n * n;
}

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

	long long X;
	cin >> X;

	for (long long i = -1000; i <= 1000; i++)
	{
		for (long long j = -1000; j <= 1000; j++)
		{
			if (process(i) - process(j) == X)
			{
				cout << i << " " << j;
				return 0;
			}
		}
	}

	return 0;
}

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

int main() {
	int N;
	string S = "";
	cin >> N;

	if(N==0)
		S += '0';

	while(N != 0) {
		if(N%(-2) == 0) {
			S += '0';
			N /= -2;
		} else {
			S += '1';
			if(N > 0)
				N /= -2;
			else
				N = N/(-2)+1;
		}
	}

	reverse(S.begin(), S.end());
	cout << S << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class CXYetAnotherDieGame {
public:
  static void solve(istream &cin, ostream &cout) {
    int x;
    cin >> x;
    cout << x / 11 * 2 + CEIL((x - x / 11 * 11), 6) << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  CXYetAnotherDieGame solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3592
INF = 10**9
h, n = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
dp = [INF] * (h + 1)
dp[0] = 0
for i in range(n):
    for j in range(h + 1):
        m = min(h, j + a[i])
        dp[m] = min(dp[m], dp[j] + b[i])
print(dp[h])


Measured memory_bytes: 41708
#include <stdio.h>

int main()
{
	int i, u, w, c, N, M, L, dist[302][302] = {};
	scanf("%d %d %d", &N, &M, &L);
	for (u = 1; u < N; u++) {
		for (w = u + 1; w <= N; w++) {
			if (dist[u][w] == 0) {
				dist[u][w] = L + 1;
				dist[w][u] = L + 1;
			}
		}
	}
	for (i = 1; i <= M; i++) {
		scanf("%d %d %d", &u, &w, &c);
		if (c <= L) {
			dist[u][w] = c;
			dist[w][u] = c;
		}
	}
	
	int v;
	for (v = 1; v <= N; v++) {
		for (u = 1; u < N; u++) {
			for (w = u + 1; w <= N; w++) {
				if (dist[u][v] + dist[v][w] < dist[u][w]) {
					dist[u][w] = dist[u][v] + dist[v][w];
					dist[w][u] = dist[u][v] + dist[v][w];
				}
			}
		}
	}
	
	int ans[302][302] = {}, q[302], head, tail;
	for (v = 1; v <= N; v++) {
		q[0] = v;
		ans[v][v] = 1;
		for (head = 0, tail = 1; head < tail; head++) {
			u = q[head];
			for (w = 1; w <= N; w++) {
				if (ans[v][w] == 0 && dist[u][w] <= L) {
					ans[v][w] = ans[v][u] + 1;
					q[tail++] = w;
				}
			}
		}
	}
	
	int Q, s, t;
	scanf("%d", &Q);
	for (i = 1; i <= Q; i++) {
		scanf("%d %d", &s, &t);
		printf("%d\n", ((ans[s][t] > 0)? ans[s][t]: 1) - 2);
	}
	fflush(stdout);
	return 0;
}

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

  for(i=1;i<=n;i++)
  {
  	b[a[i]-1]=b[a[i]-1]+1;
  }
  
  for(i=0;i<n;i++)
  {
  	printf("%d\n",b[i]);
  }
  return 0;
}

Measured memory_bytes: 3268
def examA():
    X = LI()
    for i in range(len(X)):
        if X[i]==0:
            ans = i+1
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 77100