akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static final int MOD = (int) (1e9 + 7);

    public void solve(InputReader in, PrintWriter out) {
        int h = in.nextInt(), a = in.nextInt();
        out.println((h + a - 1) / a);
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().solve(in, out);
        out.flush();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22356
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n;

	cin >> n;

	if (n < 1000) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ABD" << endl;
	}
}

Measured memory_bytes: 256
<?php
list($n) = ints();
$sum = 0;
for ($i = 1; $i <= $n; ++$i) {
    $sum += $i;
    $ans[] = $i;
    if ($sum >= $n) {
        $diff = $sum - $n;
        if ($diff) unset($ans[array_search($diff, $ans)]);
        break;
    }
}
echo implode(PHP_EOL, $ans);
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

using namespace std;

using ll = long long;

int main(){
    ll n, m, mini = INT_MAX, maxi = INT_MIN;
    cin >> n >> m;
    for(ll i = 0; i < m; ++i){
        ll tmp, tmp1; cin >> tmp >> tmp1;
        mini = min(mini, tmp1);
        maxi = max(maxi, tmp);
    }
    cout << max(min(n, mini) - maxi + 1, (ll)0);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define dump(x) cout << (x) << endl;
typedef long long Int;

Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> a(m), b(m), c(m), d(n+1);
    d[1] = 0;
    for (Int i = 2; i <= n; i++) d[i] = 1e18;
    for (Int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }
    for (Int i = 0; i < n-1; i++) {
        for (Int j = 0; j < m; j++) {
            if (d[a[j]] + c[j] < d[b[j]]) {
                d[b[j]] = d[a[j]] + c[j];
            }
        }
    }
    Int res = -d[n];
    vector <bool> ng(n+1, false);
    for (Int i = 0; i < n; i++) {
        for (Int j = 0; j < m; j++) {
            if (d[a[j]] + c[j] < d[b[j]]) {
                // cout << a[j] << " " << b[j] << endl;
                d[b[j]] = d[a[j]] + c[j];
                ng[b[j]] = true;
            }
            if (ng[a[j]]) {
                ng[b[j]] = true;
            }
        }
    }
    if (ng[n]) {
        dump("inf");
    }
    else {
        dump(res);
    }
    return 0;
}  

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int a=sc.nextInt();
		int cnt=0;
		for(int i=0; i<4; i++) {
			if(a%10==2) {
				cnt++;
			}
			a/=10;
		}
		System.out.println(cnt);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 21460
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        String s=sc.next();
        int c=0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i)=='1')c++;
            else c--;
        }
        out.println(s.length()-abs(c));
    }
}

Measured memory_bytes: 25808
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct node
{
	double x,y;
	bool operator < (const node b)
	{
		return atan2(y,x)<atan2(b.y,b.x);
	}
}a[105];
int main()
{
	int n;
	double ans = 0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lf %lf",&a[i].x,&a[i].y);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
	   double x=0,y=0;
	   int j = i;
	   do
	   {
	   	 x+=a[j].x;
	   	 y+=a[j].y;
	   	 ans=max(ans,sqrt(x*x+y*y));
	   	 j++;
	   	 j%=n;
	   }while(j!=i);
	}
	printf("%.15lf\n",ans);
}

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

bool prime[300001];
vector<int>prime_list;

int main()
{
  memset(prime,true,sizeof(prime));
  prime[1]=prime[0]=false;
  for(int i=0;i<300001;i++)
    {
      if(prime[i] && (i%7==1 ||i%7==6))
	{
	  for(int j=0;j<prime_list.size();j++)
	    if(i%prime_list[j]==0)
	      {
		prime[i]=false;
		break;
	      }
	  if(!prime[i])
	    continue;
	  prime_list.push_back(i);
	  for(int j=0;j<prime_list.size()&&i*prime_list[j]<300001; j++)
	    prime[i*prime_list[j]]=false;
	}
      else
	{
	  prime[i]=false;
	}
    }

  int n;
  for(;cin>>n,n!=1;)
    {
      cout<<n<<": ";
      int flag=false;
      for(int i=0;i<prime_list.size();i++)
	{
	  if(n%prime_list[i]==0 && ( (n/prime_list[i])%7==1||(n/prime_list[i])%7==6))
	    {
	      if(flag)
		cout<<" ";
	      flag=true;
	      cout<<prime_list[i];
	    }
	}

      cout<<endl;
    }

  //  for(int i=0;i<prime_list.size();i++)
  //    cout<<prime_list[i]<<endl;

  /*  for(int x : prime_list)
    {
      cout<<x<<endl;
    }
  */
}

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

long long I, O, T, J, L, S, Z;

int main() {
  cin >> I >> O >> T >> J >> L >> S >> Z;
  long long d = 0;
  if(I > 0 && J > 0 && L > 0) {
    int k = I % 2 + J % 2 + L % 2;
    if(k == 3) d = 3;
    else if(k == 2) d = 1;
  }
  cout << O + I / 2 * 2 + J / 2 * 2 + L / 2 * 2 + d << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;
int map[8][8];
int block[7][4][4]={
	{
		{1,1,0,0},
		{1,1,0,0},
		{0,0,0,0},
		{0,0,0,0}
	},
	{
		{1,0,0,0},
		{1,0,0,0},
		{1,0,0,0},
		{1,0,0,0}
	},
	{
		{1,1,1,1},
		{0,0,0,0},
		{0,0,0,0},
		{0,0,0,0}
	},
	{
		{1,0,0,0},
		{1,0,0,0},
		{0,0,0,0},
		{0,0,0,0}
	},
	{
		{1,1,0,0},
		{0,1,1,0},
		{0,0,0,0},
		{0,0,0,0}
	},
	{
		{1,0,0,0},
		{1,1,0,0},
		{0,1,0,0},
		{0,0,0,0}
	},
	{
		{1,1,0,0},
		{1,0,0,0},
		{0,0,0,0},
		{0,0,0,0}
	}
};

int main()
{
	int x=-1,y=-1;
	while(true)
	{
		x=-1,y=-1;
	for(int i=0;i<8;i++)
	{
		char c[10];
		if(scanf("%s",c)==EOF)goto end;
		for(int j=0;j<8;j++)
		{
			map[i][j]=c[j]-'0';
			if(map[i][j]==1&&x==-1&&y==-1)
			{
				y=i,x=j;
			}
		}
	}
	for(int i=0;i<7;i++)
	{
		bool b=true;
		for(int j=0;j<4;j++)
		{
			for(int k=0;k<4;k++)
			{
				if(map[y+j][x+k]!=block[i][j][k])b=false;
			}
		}
		if(b)printf("%c\n",'A'+i);
	}
	}
	end:
	return 0;
}

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

#define INF (1001001001)

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

using namespace std;

int main()
{
	int n, m;

	scanf("%d", &n);

	vector<string> ids(n);

	for (int i = 0; i < n; i++){
		cin >> ids[i];
	}

	bool door = false;

	scanf("%d", &m);

	for (int i = 0; i < m; i++){
		string id;

		cin >> id;

		for (int j = 0; j < n; j++){
			if (id == ids[j]){
				if (door == false){
					cout << "Opened by " << id << endl;

					door = true;
				}
				else {
					cout << "Closed by " << id << endl;

					door = false;
				}

				break;
			}

			if (j == n - 1){
					cout << "Unknown " << id << endl;
			}
		}
	}

	return (0);
}

Measured memory_bytes: 1244
#include<cstdio>
#include<cstdlib>
#define maxn 200005
#define maxm 50000005
#define p 1000000007
#define ll long long
using namespace std;
ll fact[maxn];
ll n,m;
ll prime[maxm],book[maxm];
void Euler()
{
	for(ll i=2;i<maxm;i++)
	{
		if(!book[i]) prime[++prime[0]]=i;
		for(ll j=1;j<=prime[0]&&i*prime[j]<maxm;j++)
		{
			book[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
}
ll ksm(ll a,ll b){ll s=1;while(b){if(b&1) s=s*a%p; a=a*a%p; b>>=1;}return s;}
ll C(ll n,ll m)
{
	if(n<m) return 0;
	return (fact[n]*ksm(fact[n-m],p-2))%p*ksm(fact[m],p-2)%p;
}
void solve()
{
	ll n,m;
	ll ans=1;
	scanf("%lld%lld",&n,&m);
	for(ll i=1;prime[i]<=m;i++)
	{
		if(m%prime[i]==0)
		{
			ll cnt=0;
			while(m%prime[i]==0) m/=prime[i],cnt++;
			ans=ans*C(cnt+n-1,n-1)%p;
		}
	}
	printf("%lld\n",ans);
	ans=0;			
}
int main()
{
	Euler();
	fact[0]=1;
	for(ll i=1;i<maxn;i++) fact[i]=fact[i-1]*i%p;
	solve();
	return 0;
}

Measured memory_bytes: 418432
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "AC";
    int c_count = 0;
    if (s.charAt(0) != 'A') {
      ans = "WA";
    }
    for (int i = 1; i < s.length(); i++) {
      if (Character.isUpperCase(s.charAt(i))) {
        if (i == 1 || i == s.length() - 1) {
          ans = "WA";
        } else if (i > 1 && i < s.length() - 1) {
          if (s.charAt(i) == 'C') {
            c_count++;
          } else {
            ans = "WA";
          }
        }
      }
    }
    if (c_count != 1) {
      ans = "WA";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
import java.util.Scanner;

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

    switch (S) {
    case "Sunny" :
    	System.out.println("Cloudy");
    	break;
    case "Cloudy" :
    	System.out.println("Rainy");
    	break;
    case "Rainy" :
    	System.out.println("Sunny");
    	break;
    	default:
    		break;
    }
  }
}

Measured memory_bytes: 22612
s=input()
n=len(s)
def f(c):
    for i in range(len(c)):
        if c[i]!=c[-1-i]:
            return False
    return True
if f(s) and f(s[:(n-1)//2]) and f(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")

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

int main() {
    int a,b,c,x; cin >> a >> b >> c >> x;
    int ans = 0;
    for (int i500 = 0; i500 <= a; i500++) {
        for (int i100 = 0; i100 <= b; i100++) {
            for (int i50 = 0; i50 <= c; i50++) {
                if (i500*500 + i100*100 + i50*50 == x) {
                    ans ++;
                }
            }
            // int t = x - i500*500 + i100*100;
            // if (t >= 0 and t%50==0 and t/50 <= c) {
            //     ans++;
            //}
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in(),M=in(),Q=in();
	vector<vector<int>> T(N+1,vector<int>(N+1,0));
	REP(i,M){
		int u=in(),v=in();
		T[u][v]++;
	}
	REP(i,N+1){
		REP(j,N){
			T[i][j+1]+=T[i][j];
		}
	}
	REP(i,N){
		REP(j,N+1){
			T[i+1][j]+=T[i][j];
		}
	}

	LOOP(Q){
		int u=in(),v=in();
		out(T[v][v]-T[v][u-1]-T[u-1][v]+T[u-1][u-1]);
	}

	return 0;
}


Measured memory_bytes: 1920
W = input()
count = 0
#T = input().lower()
#print(T)
#while T != 'END_OF_TEXT':
while True:
    T = input()
    if T == 'END_OF_TEXT':
        break

    for i in T.lower().split():
        if W == i:
            count += 1
    #T = input().lower()
    #print(i)

print(count)

Measured memory_bytes: 7328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
int main(){
    int n,x,ans,l,now=0;
    cin>>n>>x;
    for(ans=1;;){
        cin>>l;
        now+=l;
        if(now<=x)ans++;
        else break;
    }
    if(ans<=101)cout<<ans<<endl;
    else cout<<"101"<<endl;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var alist = new Array(N);
  var blist = new Array(N);
  for(var i = 0; i < N; i++){
    var tmp = nextIntArray();
    alist[i] = tmp[0];
    blist[i] = tmp[1];
  }
  var add = 0;
  for(var i = N - 1; i >= 0; i--){
    var tmpA = alist[i] + add;
    var tmpB = blist[i];
    add += (tmpB - (tmpA % tmpB)) % tmpB;
  }
  myout(add);
}


Measured memory_bytes: 31784
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<deque>
using namespace std;

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

	deque<int> A;

	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	while (A.size() > 1)
	{
		if (A[0] < A[A.size()-1]) {
			int distance = A[A.size()-1] - A[0];
			A[A.size()-1] = distance;
			A.pop_front();
		}
		else if (A[0] >= A[A.size()-1]) {
			int distance = A[0] - A[A.size()-1];
			A[0] = distance;
			A.pop_back();
		}
	}

	cout << A[0] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const double pi=acos(-1);
int main()
{
    double a,b;
    cin>>a>>b;
    double h;
    cin>>h;
    double m;
    cin>>m;
    double s=12.0;
    double mi=60.0;
    while(h-s>0.000001)
    {
        h=h-12.0;
    }
    while(m-mi>0.000001)
    {
        m=m-60.0;
    }
    double du=h*pi/6;
    du+=m*pi/360;
    du-=m*pi/30;
    while(du>pi)
    {
        du=2*pi-du;
    }
    double ans=a*a+b*b-2*a*b*cos(du);
    ans=sqrt(ans);
    printf("%.15f\n",ans);
}


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

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

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

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

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

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

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

  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;


  int h = h2 - h1;
  int m = m2 - m1;

  int total = h * 60 + m;

  cout << total - k << endl;




  return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		
		String[] S = new String[H];
		
		for(int i = 0; i < H; i++) {
			String s = sc.next();
			S[i] = "#" + s + "#";
		}
		
		String T = "";
		
		for(int i = 0; i < S[0].length(); i++) {
			T += "#";
		}
		
		System.out.println(T);
		
		for(int i = 0; i < H; i++) {
			System.out.println(S[i]);
		}
		
		System.out.println(T);
	}
}


Measured memory_bytes: 23596
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define eps 0.0000000001
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const int maxn = 1000000+10;
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
#endif
//    IOS

    int n;cin >> n;
    cout << "ABC" << n << endl;


    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <functional>
#include <string.h>

using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a,0,sizeof(a))
#define minus(a) memset(a,0xff,sizeof(a))
#define chmax(a,b) a=min((a),(b))
#define chmin(a,b) a=max((a),(b))


#define MOD 1000000007

typedef pair<int,int>P;
#define INF (1LL<<61)

int n, m;
ll a[100005];
ll dat[200005];
ll sum[100005];
ll ans[100005];
ll res = INF;

int main(){
	scanf("%d %d ", &n, &m);
	rep(i, n) {
		scanf("%lld ", &a[i]); a[i]--;
	}
	rep(i, n-1) {
		if (a[i] < a[i+1]) {
			dat[a[i]+1]++;
			dat[a[i + 1]]--;
		}
		else {
			dat[a[i] + 1]++;
			dat[a[i + 1] + m]--;
		}
	}
	rep(i, 2 * m) {
		dat[i + 1] += dat[i];
	}
	rep(i, m) {
		dat[i] += dat[i + m];
	}
	rep(i, n-1) {
		sum[a[i + 1]] += (a[i + 1] + m - a[i]) % m - 1;//
	}
	
	rep(i, n-1) {
		if (a[i] > a[i + 1]) {
			ans[0] += 1 + a[i + 1];
		}
		else {
			ans[0] += a[i + 1] - a[i];
		}
	}
	FOR(i, 1, m) {
		ans[i] += sum[i-1];//
		ans[i] -= dat[i - 1];
		ans[i] += ans[i - 1];
	}
	rep(i, m) {
		res = min(res, ans[i]);
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4096
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

from itertools import permutations
def main():
    a = 0
    b = 0
    per = list(permutations(range(1,N + 1),N))
    for i,p in zip(range(len(per)),per):
        if p == P:
            a = i
        if p == Q:
            b = i
    print(abs(a-b))
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 8052
(* unihernandez22
 * https://atcoder.jp/contests/abc172/tasks/abc172_a
 * implementation
 * *)

let rec pow a b =
    if b == 0 then
        1
    else
        a * pow a (b - 1);;

Printf.printf "%d\n" @@
Scanf.scanf "%d" @@ fun a ->
    a + pow (a) (2) + pow (a) (3);



Measured memory_bytes: 3812
from collections import defaultdict
import heapq
n, m, s, t = map(int, input().split())


class Graph():
    def __init__(self):
        self.graph = defaultdict(list)


    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))


class Dijkstra():
    def __init__(self, graph, start):
        self.g = graph.graph
        self.dist = defaultdict(lambda: float("inf"))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)
        self.queue = []
        heapq.heappush(self.queue, (self.dist[start], start))

        while self.queue:
            dist_u, u = heapq.heappop(self.queue)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heapq.heappush(self.queue, (alt, v))


    def shortest_dist(self, goal):
        return self.dist[goal]

    
    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]


yen_max = 10 ** 15
cost = [0] * n
train_yen = Graph()
train_sno = Graph()
for i in range(m):
    u, v, a, b = map(int, input().split())
    train_yen.add_edge(u - 1, v - 1, a)
    train_yen.add_edge(v - 1, u - 1, a)
    train_sno.add_edge(u - 1, v - 1, b)
    train_sno.add_edge(v - 1, u - 1, b)

cost_yen = Dijkstra(train_yen, s - 1)
cost_sno = Dijkstra(train_sno, t - 1)
for i in range(n):
    cost[i] = yen_max - (cost_yen.dist[i] + cost_sno.dist[i])

ans = [yen_max] * n
ans[n - 1] = cost[n - 1]
for i in range(n - 2, -1, -1):
    ans[i] = max(ans[i + 1], cost[i])
print(*ans, sep="\n")

Measured memory_bytes: 143604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  ll a,b,c;
  string s;
  cin >> a >> b >> c;
  ll right;
  ll left;
  left = 4*a*b;
  if (c-a-b < 0) {
    cout << "No" << endl;
    return 0;
  }
  right = (c-a-b)*(c-a-b);
  if (left < right) cout << "Yes" << endl;
  else cout << "No" << endl; 
  return 0;
}

Measured memory_bytes: 256
// Author : heyuhhh
// Created Time : 2020/08/30 19:28:57
#include<bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 2e6 + 5;
void run() {
    int k;
    cin >> k;
    int now = 0;
    for (int i = 1; i <= N; i++) {
        now = (now * 10 + 7) % k;
        if (now == 0) {
            cout << i << '\n';
            return;
        }
    }
    cout << -1 << '\n';
}
int main() {
#ifdef Local
    freopen("input.in", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)
  __gcd(a,b)は最大公約数を取ってくれる、aとb
  の大きい方をNとしたとき、計算量はlog N (この書き方、底は２）
 */
const int mod = 1e9 + 7;
//ここから書き始める
#define MAX 100000
#define SENTINEL 2e9

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2 +2], R[MAX / 2 + 2];

//関数の定義はここ
void merge(struct Card A[], int n, int left, int mid, int right){
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i = 0; i < n1; i++){
		L[i] = A[left+i];
	}
	for(int i = 0; i < n2; i++){
		R[i] = A[mid+i];
	}
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	for( k = left; k < right ; k++){
		if(L[i].value <= R[j].value){
			A[k] = L[i++];
		}
		else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[], int n , int left, int right){
	int mid;
	if(left+1 < right){
		mid = (left + right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}

int partition(struct Card A[], int n, int p, int r){
	int i,j;
	struct Card t, x;
	x = A[r];
	i = p - 1;
	for(j = p ; j < r ; j++){
		if ( A[j].value <= x.value){
			i++;
			t = A[i];A[i]= A[j]; A[j] = t;
		}
	}
	t =A[i+1]; A[i+1]=A[r]; A[r] = t;
	return i + 1 ;
}

void quickSort(struct Card A[], int n, int p, int r){
	int q;
	if(p<r){
		q = partition(A,n,p,r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(){
	int n, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable = 1;

	cin >> n ;

	rep(i,n){
		cin >> S[i] >> v;
			A[i].suit = B[i].suit = S[i];
		A[i].value = B[i].value = v;
	}
	mergeSort(A, n, 0, n);
	quickSort(B, n, 0, n-1);

	rep(i,n){
		if (A[i].suit != B[i].suit) stable = 0;
	}

	//以下はマージとクイックの結果が違ったらnot stable を出力する処理
	if(stable) cout<<"Stable"<<endl;
	else cout<<"Not stable"<<endl;
	rep(i,n){
		cout<<B[i].suit<<" "<<B[i].value<<endl;
	}
}



Measured memory_bytes: 5424
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include<algorithm>
#include <queue>
using namespace std;
 
#define int long long
#define INF 1001001001
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}

 int arr[101];
int32_t main() {
 
  
  int N;
  cin >> N;
  
  for(int i=1; i<=N; i++){
  	
  	cin >> arr[i];	
  	
  }
 	
  int mini = INT_MAX; 
  int sum = 0;
  for(int i=1; i<=100; i++ ){
  	sum = 0;
  	for(int j=1; j<=N; j++){
  		
  		sum= sum + (arr[j] - i) *  (arr[j] - i);
  		
	}
  	
  	mini = min(mini,sum);
  	
  }
 cout << mini << endl;
}

Measured memory_bytes: 3136
#include<cstdio>
#include<iostream> 
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#define ll long long
using namespace std;
ll n;
ll a[100005];
int main()
{
	scanf("%lld",&n);
	int flag = 1;
	ll sum = 0;
	for(int i = 0;i < n;i ++)
	{
		scanf("%d",&a[i]);
		sum += a[i];
	}
	if(sum % (n * (n + 1) / 2))
	{
		flag = 0;
		//cout << "OHA" << endl;
	}
	ll num = sum / (n * (n + 1) / 2); 
	for(int i = 0;i < n;i ++)
	{
		ll ds = a[(i + 1) % n] - a[i];
		if(abs(ds - num) % n != 0 || ds > num)
		{
			flag = 0;
			//cout << i << "OHA" << endl;
		}
	}
	if(flag)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
} 

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;++i)
    {
        cin >> a[i];
    }
    bool flag = true;
    int count = 0;
    while(flag)
    {
        flag = false;
        for(int j = n-1; j>0; --j)
        {
            if(a[j] < a[j-1])
            {
                int tmp = a[j-1];
                a[j-1] = a[j];
                a[j] = tmp;
                flag = true;
                ++count;
            }
                
        }
    }
    for(int k=0;k<n;++k)
    {
        cout << a[k];
        if(k==n-1)
            cout << endl;
        else
            cout << " ";
    }
    cout << count << endl;

}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int h,w,d;
int a[110][110];
int b[110][110];
int ans;


bool g(){
  bool flag=false;
  rep(j,w){
    int l=h-1;
    while(l>0){
      int i=l;
      while(b[i][j]>0&&i>=0) i--;
      if(i<0) break;
      int k=i;
      while(b[k][j]<0&&k>=0) k--;
      if(k<0) b[i][j]=-1;
      else{
        b[i][j]=b[k][j];
        b[k][j]=-1;
        flag=true;
      }
      l--;
    }
  }

  return flag;
}



void f(){

  int res=0;
  int m=1;

  while(g()){
    int r=0;
    rep(i,h){
      int j=0;
      while(j<w){
        int k=j;
        while(b[i][j]==b[i][k]&&k<w) k++;
        if(b[i][j]==-1||k-j<d){
          j=k;
          continue;
        }
        r+=b[i][j]*(k-j)*m;
        FOR(l,j,k){
          b[i][l]=-1;
        }
        j=k;
      }
    }
    m*=2;
    res+=r;
  }
  ans = max(ans,res);
}


int main(){
  cin>>h>>w>>d;
  char c[110][110];

  rep(i,h){
    cin>>c[i];
    rep(j,w){
      a[i][j]=c[i][j]-'0';
      b[i][j]=a[i][j];
    }
  }

  
  rep(i,h){
    rep(j,w){
      b[i][j]=-1;
      f();
      rep(ii,h){
        rep(jj,w){
          b[ii][jj]=a[ii][jj];
        }
      }
    }
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);

int main(void){
  int x,y;
  cin >> x >> y;
  if(x == 2 || y == 2){
    cout << "No" << endl;
  } else if(x == 4 || x == 6 || x == 9 || x ==11){
    if(y == 4 || y == 6 || y == 9 || y ==11){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    if(y == 4 || y == 6 || y == 9 || y ==11){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int n;
  cin >> n;
  vector<long> a(3*n);
  rep(i,3*n) cin >> a.at(i);
  priority_queue<long, vector<long>, greater<long>> begin;
  priority_queue<long> end;
  vector<long> maxi(n+1,0);
  vector<long> mini(n+1,0);
  rep(i,n){
    begin.push(a.at(i));
    maxi.at(0) += a.at(i);
    end.push(a.at(3*n-1-i));
    mini.at(0) += a.at(3*n-1-i);
  }
  //cout << "check" << endl;
  for(int i=1;i<=n;i++){
    long tmp = begin.top();
    maxi.at(i) = maxi.at(i-1);
    //cout << "check" << i << endl;
    if(a.at(n-1+i) > tmp){
      maxi.at(i) += a.at(n-1+i) - tmp;
      begin.pop();
      begin.push(a.at(n-1+i));
    }
    //cout << "check" << i << endl;
    long tmp1 = end.top();
    mini.at(i) = mini.at(i-1);
    if(a.at(2*n - i) < tmp1){
      mini.at(i) -= tmp1 - a.at(2*n - i);
      end.pop();
      end.push(a.at(2*n - i));
    }
    //cout << "check" << i << endl;
  }
  //cout << "check" << endl;
  long ans = -1e15;
  rep(i,n+1){
    ans = max(ans,maxi.at(i)-mini.at(n-i));
    //cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5996
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    string S, T; cin >> S >> T;

    string ans = "";
    rep (i, 0, N) {
        ans += S[i];
        ans += T[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using long_t = int64_t;

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		int N, K, R, S, P;
		string T;
		cin >> N >> K >> R >> S >> P >> T;

		long_t sc = 0;
		string u( K, '-' );
		for( int i = 0; i < N; ++i ) {
			if( T[i] == 'r' ) {
				if( u[i%K] == 'p' ) { u[i%K] = '-'; }
				else { sc += P; u[i%K] = 'p'; }
			}
			else if( T[i] == 's' ) {
				if( u[i%K] == 'r' ) { u[i%K] = '-'; }
				else { sc += R; u[i%K] = 'r'; }
			}
			else if( T[i] == 'p' ) {
				if( u[i%K] == 's' ) { u[i%K] = '-'; }
				else { sc += S; u[i%K] = 's'; }
			}
		}

		cout << sc << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void)
{

    char str[1200];
    int i;
    int strLength;

    //文字列を入力する
    fgets(str, 1200, stdin);

    //strの長さを入れる
    strLength = strlen(str);

    //文字列の長さより小さい間
    for(i = 0; i < strLength; i++)
    {
        //英字だった場合
        if(isalpha(str[i]) != 0)
        {
            //大文字を小文字に置き換える
            if(isupper(str[i]) != 0)
            {
                str[i] = tolower(str[i]);
            }
            //小文字を大文字に置き換える
            else if(islower(str[i]) != 0)
            {
                str[i] = toupper(str[i]);
            }
        }

    }

    //変換した文字列を出力する
    printf("%s", str);

    return 0;
}


Measured memory_bytes: 2044
#include<iostream>

using namespace std;

int main(){

	int a,b,c,d,e,k,i;
	cin >>a>>b>>c>>d>>e>>k;
	
	if(b-a >k) cout << ":("<<endl;
	else if(c-a>k) cout << ":("<<endl;
	else if(d-a>k) cout << ":("<<endl;
	else if(e-a>k) cout << ":("<<endl;
	else if(c-b>k) cout << ":("<<endl;
	else if(d-b>k) cout << ":("<<endl;
	else if(e-b>k) cout << ":("<<endl;
	else if(d-c>k) cout << ":("<<endl;
	else if(e-c>k) cout << ":("<<endl;
	else if(d-e>k) cout << ":("<<endl;
	else cout << "Yay!"<<endl;
	
	return 0;



} 

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

using namespace std;

int main(){
  int n,t,a,temp;
  vector<int> h;

  cin >> n >> t >> a;
  for(int i=0; i<n; ++i){
    cin >> temp;
    h.push_back(temp);
  }

  double best;
  int index=0;
  best = t - h[0]*0.006;
  for(int i=1; i<h.size(); ++i){
    if(abs(t-h[i]*0.006-a) < abs(best-a)){
      index = i;
      best = t-h[i]*0.006;
    }
  }

  cout << index+1 << endl;
  return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    r = 'Christmas'
    for _ in range(n,25):
        r += " Eve"

    return r


print(main())


Measured memory_bytes: 5456
#include <iostream>

using namespace std;

int main(){
	char s;
	cin >> s;
  	if(s == 'A') cout << 'T' << "\n";
  	else if(s == 'T') cout << 'A' << "\n";
  	else if(s == 'G') cout << 'C' << "\n";
  	else if(s == 'C') cout << 'G' << "\n";
  
  	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

int main(){
    int k;
    cin>>k;
    if(k%2==0 || k%5==0){
        cout<<-1<<endl;
        return 0;
    }

    ll sum = 0;
    for(int i=1;;i++){
        sum=((sum*10)+7)%k;
        if(sum%k==0){
            cout<<i<<endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3532
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(A+B >= 24){
		ans = A+B-24;
	}else{
		ans = A+B;
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> A >> B;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int W,D;
int main(){
  while( cin>> W >> D && (W||D) ){
    int H1[22];
    int H2[22];
    for(int i=0;i<W;i++)
      cin >> H1[i];
    for(int i=0;i<D;i++)
      cin >> H2[i];
    bool used[22]={};
    int cnt = 0;
    for(int i=0;i<W;i++){
      for(int j=0;j<D;j++){
	if( used[j] ) continue;
	if( H1[i] == H2[j] ) {
	  used[j] = true;
	  break;
	}
      }
      cnt += H1[i];
    }
    // cout << cnt << endl;
    for(int i=0;i<D;i++){
      if( used[i] ) continue;
      //  cout << H2[i] << endl;
      cnt += H2[i];
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
const ll MAXN=1e5+51;
string s,t,u;
ll x,y;
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
int main()
{
	cin>>s>>t,x=read(),y=read(),cin>>u;
	u==s?x--:y--;
	printf("%d %d\n",x,y);
}

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

int main() {
	long long int n,c=0;
	cin>>n;
	while(n>=500)
  {
      n=n-500;
      c=c+1000;
  }
  while(n>=5)
  {
      n=n-5;
      c=c+5;
  }
	cout<<c;
}

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

int main() {
  int N, M, num = 0;

  // N が偶数、M が奇数
  cin >> N >> M;

  int n[N], m[M];

  for(int i = 0; i < N; i++){
    n[i] = (i + 1)*2;
  }

  for(int i = 0; i < M; i++){
    m[i] = i*2 + 1;
  }

  for(int i = 0; i < N; i++){
    for(int j = i+1; j < N; j++){
      
      if((n[i] + n[j]) % 2 == 0){
        num++;
      }
    }
  }

  for(int i = 0; i < M; i++){
    for(int j = i+1; j < M; j++){
      
      if((m[i] + m[j]) % 2 == 0){
        num++;
      }
    }

  }

  cout << num << endl;

  return 0;
}

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

typedef long long int ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vll> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpl;
typedef unordered_set<ll> usl;
typedef set<ll> sl;
typedef unordered_map<ll, ll> uml;
typedef map<ll, ll> ml;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

#define all(v) v.begin() , v.end()
#define ceil(a, b) (a + b - 1) / b
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll inf = 1e9 + 7;
const double pie = 3.14159265358979323846;
const char nl = '\n';
const char spc = ' ';

template<typename Type>
istream &operator>>(istream &in, vector<Type> &v)
{
    ll n = v.size();
    for (int i = 0; i < n; i++)
        in >> v[i];
    return in;
}

template<typename Type>
ostream &operator<<(ostream &out, vector<Type> &v)
{
    for (auto value : v)
        out << value << ' ';
    out << nl;
    return out;
}

bool isPrime (ll n)
{
    if (n < 4)
        return true;
    if (n % 2 == 0)
        return false;
    ll i = 3;
    while (i * i <= n)
    {
        if (n % i == 0)
            return false;
        i += 2;
    }
    return true;
}

void solve ()
{
    ll n, W;
    cin >> n >> W;
    vll wt(n + 1), val(n + 1);
    for (ll i = 1; i <= n; ++i)
        cin >> wt[i] >> val[i];
    ll max_val = 0;
    for (ll i : val)
        max_val += i;
    vvl dp(n + 1, vll(max_val + 1, inf));
    for (ll i = 0; i <= n; ++i)
        dp[i][0] = 0;
    for (ll i = 1; i <= n; ++i)
    {
        ll wi = wt[i], vi = val[i];
        for (ll v = 1; v <= max_val; ++v)
        {
            if (vi <= v)
                dp[i][v] = min (wi + dp[i - 1][v - vi], dp[i - 1][v]);
            else
                dp[i][v] = dp[i - 1][v];
        }
    }
    ll ans = 0;
    for (ll i = 1; i <= max_val; ++i)
    {
        if (dp[n][i] <= W)
            ans = i;
    }
    cout << ans << nl;
}

int main()
{
    IOS
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll t;
    t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 83040
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

#n = int(input())
h,w,a,b = [int(i) for i in readline().split()]


ans = [[0]*w for i in range(h)]

for i in range(b):
    ans[i][:w-a] = [1]*(w-a)
for i in range(b,h):
    ans[i][w-a:] = [1]*(a)

for i in ans:
    print(*i,sep="")














Measured memory_bytes: 13300
import itertools
N=int(input())
l=[0]*5
m=list('MARCH')
for i in range(N):
    S=input()
    if S[0] in m:
        l[m.index(S[0])]+=1
ans=0
for i in list(itertools.combinations(l,3)):
    m=1
    for j in i:
        m*=j
    ans+=m
print(ans)

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int d[200000];
P p[200000];
vector<int>E[200000];
int col[200000];
int A[200000],B[200000];

int main(){
	int n,m;cin>>n>>m;
	rep(i,n){
		scanf("%d",&d[i]);
		p[i].first=d[i];
		p[i].second=i;
	}
	rep(i,m){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
		A[i]=a;B[i]=b;
	}
	sort(p,p+n);
	memset(col,-1,sizeof(col));
	rep(x,n){
		int i=p[x].second;
		if(col[i]!=-1)continue;
		bool ok=false;
		for(int u:E[i]){
			if(d[u]<=d[i])ok=true;
		}
		if(!ok){
			puts("-1");return 0;
		}
		col[i]=0;
		queue<int>que;
		que.push(i);
		while(!que.empty()){
			int s=que.front();que.pop();
			for(int u:E[s]){
				if(d[u]>=d[s]&&col[u]==-1){
					col[u]=!col[s];
					que.push(u);
				}
			}
		}
	}
	rep(i,n){
		if(col[i])cout<<"W";
		else cout<<"B";
	}
	cout<<endl;
	rep(i,m){
		printf("%d\n",max(d[A[i]],d[B[i]]));
	}
}

Measured memory_bytes: 14720
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int [] num = new int[n];
        for (int i = 0; i < n; ++i) {
            num[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 1; i < n - 1; ++i) {
            if (num[i - 1] < num[i] && num[i] < num[i + 1]) {
                ++count;
            } else if (num[i - 1] > num[i] && num[i] > num[i + 1]) {
                ++count;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23764
'use strict'

function main(input){
  const lines = input.split('\n');
  const ABCDEF = lines.shift().split(' ').map(x => parseInt(x));
  const A = ABCDEF[0];
  const B = ABCDEF[1];

  const C = ABCDEF[2];
  const D = ABCDEF[3];

  const E = ABCDEF[4];
  const F = ABCDEF[5];

  let water = [];
  let sugers = [];
  for(let i=0;i<=F;i++){
    for(let j=0;j<=F;j++){
      let current_water = 100*(A*i+B*j);
      if(current_water<=F){ water.push(current_water); }

      let current_suger = C*i + D*j;
      if(current_suger<=F){ sugers.push(current_suger); }
    }
  }

  let results = [];
  let limit_density = 100*E/(100+E);

  for(let i=0;i<water.length;i++){
    for(let j=0;j<sugers.length;j++){
      let total = water[i] + sugers[j];
      let melt_suger = 100*sugers[j]/water[i];
      if( (total <= F) && (melt_suger <= E) ){
        results.push([water[i], sugers[j]]);
      }
    }
  }

  let tmp_melt_suger = 0;
  let idx = 0;
  for(let i=0;i<results.length;i++){
      let current_suger = (100*results[i][1])/(results[i][0]+results[i][1]);
      if(current_suger > tmp_melt_suger){ 
        tmp_melt_suger = current_suger;
        idx = i;
      }
  }
  console.log((results[idx][0] + results[idx][1])+' '+results[idx][1]);
}
main( require('fs').readFileSync( '/dev/stdin', 'utf8') );


Measured memory_bytes: 103084