akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	i, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	var total, btc float64
	for i := 0; i < n; i++ {
		x := readFloat64()
		s := readString()
		if s == "JPY" {
			total += x
		} else {
			btc += x
		}
	}
	printf("%f\n", total+btc*380000)
}

// -----------------------------------------------------------------------------


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

struct Point{
	double x, y;
};

void koch(int n, Point a, Point b)
{
	if (n == 0)return;
	Point s, t, u;
	double th = 3.14159265359 * 60.0 / 180.0;
	
	s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
	s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
	t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
	t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
	
	koch(n - 1, a, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, b);
}

int main()
{
	Point a, b;
	int n;
	cin >> n;
	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;
	printf("%.8f %.8f\n", a.x, a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);
	return 0;
}


Measured memory_bytes: 3144
#n = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))
a_L = []
for _ in range(4):
    a_L.append(int(input()))
print(min(a_L[0],a_L[1])+min(a_L[2],a_L[3]))

Measured memory_bytes: 38384
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int x;cin>>x;
    if(x==3||x==5||x==7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
    int n;
    cin >> n;
    VI a(n);
    rep(i,n){
        cin >> a.at(i);
    }
    ll mn=100000000000000;
    for(int i=-100;i<=100;i++){
        ll cnt=0;
        rep(j,n){
            cnt+=(a.at(j)-i)*(a.at(j)-i);
        }
        mn=min(cnt,mn);
    }
    cout << mn << endl;
}

Measured memory_bytes: 256
//  __/\\\\____________/\\\\______/\\\\\\\\\______/\\\________/\\\___/\\\\\\\\/\\____/\\\\\\\\\\_|
//   _\/\\\\\\________/\\\\\\____/\\\\\\\\\\\\\___\/\\\________/\\\__\/\\\____\/\\\__\////\\\///__|
//    _\/\\\//\\\____/\\\//\\\___/\\\/////////\\\__\/\\\________/\\\__\/\\\____\/\\\\____\/\\\_____|
//     _\/\\\\///\\\/\\\/_\/\\\__\/\\\_______\/\\\__\/\\\\\\\\\\\\\\\__\/\\\____\/\\\\____\/\\\_____|
//      _\/\\\__\///\\\/___\/\\\__\/\\\\\\\\\\\\\\\__\/\\\/////////\\\__\/\\\____\/\\\\____\/\\\_____|
//       _\/\\\____\///_____\/\\\__\/\\\/////////\\\__\/\\\_______\/\\\__\/\\\____\/\\\_____\/\\\_____|
//        _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\___/\\\\______\/\\\_____|
//         _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\\\\/\\_____/\\\\\\\\\\__|
//          _\///______________\///___\///________\///___\///________\///___\/////////_____\//////////___|
#include<bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< string > vs;
typedef vector< long long > vl;
#define hurry ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define setp setprecision
#define popp pop_back()
#define pb push_back
#define mp make_pair
#define beg begin()
#define end end()
#define sc second
#define sz size()
#define fr first
#define endl '\n'
//=======================================================================================================================
//GLOBAL
ll dp[100002];
ll ans;
//=======================================================================================================================
//FUNCTIONS
//=======================================================================================================================
int main()
{
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
        dp[i]=1e9+1;
    }
    for(int i=3;i<=n;i++)
    {
        if(i>k)
        {
            for(int j=i-k;j<i;j++)
                dp[i]=min(dp[i],(dp[j]+abs(h[i]-h[j])));
        }
        else
        {
            for(int j=1;j<i;j++)
                dp[i]=min(dp[i],(dp[j]+abs(h[i]-h[j])));
        }
    }
    cout<<dp[n];
}
//========================================================================================================================


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<cmath>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int kazu[1000100];

int main()
{
	int n;
	cin >> n;
	
	REP(i,n)
	{
		int tmp;
		cin >> tmp;
		kazu[tmp]++;
		kazu[tmp+1]++;
		if(tmp>0)kazu[tmp-1]++;
	}
	
	int ans = 0;
	int ret = 0;
	REP(i,1000001)
	{
		if(kazu[ans]<kazu[i])
		{
			ans = i;
		}
	}
	
	cout << kazu[ans] << endl;
	
		
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
vector<int> E[101010];
ll mo=1000000007;
ll ret=1;

void dfs(int cur,int pre,int num) {
	ret=ret*num%mo;
	
	num=K-1;
	if(pre!=-1) num--;
	FORR(e,E[cur]) if(e!=pre) {
		dfs(e,cur,num);
		num--;
	}
	
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N-1) {
		cin>>x>>y;
		x--,y--;
		E[x].push_back(y);
		E[y].push_back(x);
	}
	
	dfs(0,-1,K);
	cout<<ret<<endl;
}




int main(int argc,char** argv){
		 solve(); 
}


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

int main(){

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

  vector<int> edge[n];

  for(int i=0;i<m;i++){
    int u,v;
    cin >> u >> v;u--;v--;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }

  vector<int> dist(n,-1);
  queue<int> que;

  int start=0;
  que.push(start);
  dist[start]=0;

  while(!que.empty()){
    int now = que.front();
    que.pop();

    for(int to:edge[now]){
      if(dist[to]!=-1) continue;

      dist[to]=dist[now]+1;
      que.push(to);
    }
  }

  bool flag=1;

  for(int i=0;i<n;i++){
    if(dist[i]==-1){
      flag=0;
      break;
    }
  }

  if(flag==0) cout << "No" << endl;
  else{
    cout << "Yes" << endl;
    for(int i=1;i<n;i++){
      for(int to:edge[i]){
        if(dist[to]==dist[i]-1){
          cout << to+1 << endl;
          break;
        }
      }
    }
  }
}

Measured memory_bytes: 10192
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    string s;cin >> s;
    int count = 0;
    vi v;
    rep(i, s.size()) {
        if(i==0)count++;
        else {
            if(s[i]==s[i-1]) count++;
            else {
                v.pb(count);
                count=1;
            }
        }
    }
    v.pb(count);
    // for(auto p:v)cout << p << ' ';
    // cout << endl;
    int ans = 0;
    if(s[0]=='<') {
        rep(i, v.size()) {
            if(i==v.size()-1) ans+=v[i]*(v[i]+1)/2;
            else {
                ans+=max(v[i],v[i+1])*(max(v[i],v[i+1])+1)/2+min(v[i],v[i+1])*(min(v[i],v[i+1])-1)/2;
                i++;
            }
        }
    }
    else {
        rep(i, v.size()) {
            if(i==0) ans+=v[i]*(v[i]+1)/2;
            else if(i==v.size()-1) ans+=v[i]*(v[i]+1)/2;
            else {
                ans+=max(v[i],v[i+1])*(max(v[i],v[i+1])+1)/2+min(v[i],v[i+1])*(min(v[i],v[i+1])-1)/2;
                i++;
            }
            // cout << ans << endl;
            // cout << "i:" << i << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int M = 2;
int a[M][M], b[M][M], w[M][M];
int n;

//???????£?
//recursive function(with/without memo)

void multiple_mat_ab_b() {
  int i, j, k;
  memset(w, 0, sizeof(w));
  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
      for (k=0; k<M; k++)
        w[i][j] += a[i][k]*b[k][j];

  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
        b[i][j] = w[i][j];
}

void multiple_mat_aa_a() {
  int i, j, k;
  memset(w, 0, sizeof(w));
  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
      for (k=0; k<M; k++)
        w[i][j] += a[i][k]*a[k][j];

  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
        a[i][j] = w[i][j];
}

void pow_mat_a(int k) {
  a[0][0] = a[0][1] = a[1][0] = 1;
  a[1][1] = 0;

  b[0][0] = b[1][1] = 1;
  b[0][1] = b[1][0] = 0;

/*
  while (k) {
    if (k & 1) multiple_mat_ab_b();
    multiple_mat_aa_a();
    k >>= 1;
  }
*/
  for (int i=0; i<k; i++)
    multiple_mat_ab_b();
}

int main() {
  scanf("%d ", &n);
  pow_mat_a(n);
  printf("%d\n", b[1][0]+b[1][1]);

	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	long long ans=0, n,x,y,k,count=0;
	bool check = false;
	char c[6];
	vector<llint> a;
	cin >> k >> n;
	rep(i, n) {
		cin >> x;
		a.push_back(x);
	}
	sort(a);
	rep(i, n-1) {
		count = a.at(i + 1) - a.at(i);
		ans = max(ans, count);
	}
	count = (k+a.at(0)) - a.at(n - 1);
	ans = max(ans, count);
	cout << k - ans << endl;
	please AC;
}


Measured memory_bytes: 2420
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long long
using namespace std;

signed main() {
	int N,M;
	cin >> N >> M;
	if(max(M,N) - min(M,N) > 1) {
		cout << 0 << endl;
	}
	else {
		if(N == M) {
			int count = 1;
			for(int i = 1;i <= N;i++) {
				count = count * i % 1000000007;
			}
			cout << count * count * 2 % 1000000007 << endl;
		}
		else {
			int count = 1;
			int count2 = 1;
			for(int i = 1;i <= N;i++) {
				count = count * i % 1000000007;
			}
			for(int i = 1;i <= M;i++) {
				count2 = count2 * i % 1000000007;
			}
			cout << count * count2 % 1000000007 << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

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

Measured memory_bytes: 256
class DrawingLots
  def initialize(width, switch_ary)
    @results = (1..width).to_a
    switch_ary.each do |data|
      tmp                   = @results[data[1] - 1]
      @results[data[1] - 1] = @results[data[0] - 1]
      @results[data[0] - 1] = tmp
    end
  end

  attr_accessor :results

  def all_result
    return @results
  end
end

width = gets.to_i
switch_ary = []
gets.to_i.times do
  switch_ary << gets.split(",").map(&:to_i)
end

puts DrawingLots.new(width, switch_ary).all_result.join("\n")

Measured memory_bytes: 6112
function Main(input){
    var inputs = input.split('/');

    var y = parseInt(inputs[0],10);
    var m = parseInt(inputs[1],10);
    var d = parseInt(inputs[2],10);


    if(y <= 2019 && m <= 04 && d <= 30){
        console.log('Heisei');
    }else{
        console.log('TBD');
    }

}
Main(require('fs').readFileSync('/dev/stdin','utf8'));



Measured memory_bytes: 7372
n,k=map(int,input().split())
t= list(map(int,input().split()))

import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
    print(0)
    sys.exit()
else:
    for i in range(delete_count):
        if len(c)>k:
            ans+=c[i]
            
print(ans)
sys.exit()
        



Measured memory_bytes: 32440
#include <iostream>                                          
using namespace std;                                         
                                                             
int main() {                                                 
  while (true) {                                             
    int a, b;                                                
    char op;                                                 
    cin >> a >> op >> b;                                     
    if (op=='?') {                                           
      break;                                                 
    }                                                        
    int ans;                                                 
    switch (op) {                                            
    case '+':                                                
      ans = a+b;                                             
      break;                                                 
    case '-':                                                
      ans = a-b;                                             
      break;                                                 
    case '*':                                                
      ans = a*b;                                             
      break;                                                 
    case '/':                                                
      ans = a/b;                                             
      break;                                                 
    default:                                                 
      break;                                                 
    }                                                        
    cout << ans << endl;                                     
  }                                                          
  return 0;                                                  
}                                                            
                                                             
                                                             
                                                             
               

Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <vector>
#include <bitset>
#include <stack>
#include <iomanip>
#include <set>
#include <queue>
#include <map>


typedef long long ll;
typedef unsigned long long ull;
#define mk make_pair
#define mkt make_tuple

using namespace std;
int const N = 200005;
int main()
{
	ll n;
	cin >> n;
	cout << (n%10 == 7 || n/10%10 == 7 || n/100%10 == 7 ? "Yes" : "No");
}


Measured memory_bytes: 3636
a,b,c=map(int,input().split())
l=[]
count=0
if any([a%2==1,b%2==1,c%2==1]):
    print(0)
    exit()
while True:
    a,b,c=a//2,b//2,c//2
    a,b,c,=b+c,a+c,a+b
    count+=1
    if any([a%2==1,b%2==1,c%2==1]):
        print(count)    
        exit()
    elif [a,b,c]in l:
        print(-1)
        exit()
    l.append([a,b,c])

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

ans = 0
for i in range(1,N):
    s1 = S[:i]
    s2 = S[i:]
    s1 = set(s1)
    s2 = set(s2)
    ans = max(ans,len(s1.intersection(s2)))

print(ans)

Measured memory_bytes: 3060
n = int(input())
if n<10:
  print(n)
  exit()
ans = 0
for i in range(10,n+1):
  if i%10 == 0:
    continue
  x,y = str(i)[0],str(i)[-1]
  x,y = int(x),int(y)
  k = len(str(n))
  for j in range(1,7):
    if (y+1)*10**j+x-10<=n:
      ans += 10**(j-1)
    else:
      if y*10**j+x>n:
        break
      else:
        ans += (n-y*10**j-x)//10+1
        break
for i in range(1,10):
  for j in range(1,7):
    if (i+1)*10**j+i-10<=n:
      ans += 10**(j-1)*2
    else:
      if i*10**j+i>n:
        break
      else:
        ans += ((n-i*10**j-i)//10+1)*2
        break
ans += 9
print(ans)

Measured memory_bytes: 42728
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
int main()
{
    // 文字列の入力
    string S, T;
	cin >> S;
	cin >> T;
	
	int count = 0;
	
	for(int i = 0; i < S.length(); i++) {
		if(S[i] != T[i]) {
			count++;
		}
	}
	
	printf("%d\n", count);
	
    return 0;
}

Measured memory_bytes: 3912
#include <iostream>
#define MAX_V 100
#define INF 100000000
using namespace std;

int V;
int s, g1, g2;
int d[MAX_V][MAX_V];

void warshall_floyd(){
  for(int k=0;k<V;k++){
    for(int i=0;i<V;i++){
      for(int j=0;j<V;j++){
	d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
}

main(){
  int n, m;
  while(1){
    cin >> n >> m >> s >> g1 >> g2;
    if(n==0 && m==0 && s==0 && g1==0 && g2==0) break;
    s--;
    g1--;
    g2--;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j) d[i][j]=0;
	else d[i][j]=INF;
      }
    }
    for(int i=0;i<m;i++){
      int b1, b2, c;
      cin >> b1 >> b2 >> c;
      b1--;
      b2--;
      d[b1][b2]=c;
    }
    V=n;
    warshall_floyd();
    int ans=INF+INF;
    for(int i=0;i<n;i++){
      int tmp=d[s][i]+d[i][g1]+d[i][g2];
      if(ans>tmp) ans=tmp;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

int a[111111];

void solve(istream& cin, ostream& cout) {
    int n;
    cin >> n;
    rep(i, 0, n) {
        cin >> a[i];
    }
    reverse(a, a + n);
    if (a[0] != 2) {
        cout << -1;
        return;
    }
    lint mn = 2;
    lint mx = 3;
    rep(i, 1, n) {
        lint x = (mn + a[i] - 1) / a[i];
        mn = a[i] * x;
        x = mx / a[i];
        mx = a[i] * x + a[i] - 1;
        if (mn > mx || mn < a[i]) {
            cout << -1;
            return;
        }
    }
    cout << mn << " " << mx;
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

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

using namespace std;

int n;

int main(){
	while(1){
		cin >> n;
		if(!n){
			break;
		}
		int s = 0, p = 0;
		rep(i, n){
			int a, b;
			cin >> a >> b;
			s += (a + b);
			if(a >= b){
				p += a > b ? a + b : a; 
			}
		}
		cout << p << ' ' << s - p << endl;
	}
	return 0;
}

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

#define clr(arr,val) memset(arr,val ,sizeof arr)
//#define first f
//#define second s

typedef  long long ull;
typedef long long ll;
ll const oo=1e18 ;

int const SZ= (int)1e5+5;
//const ll mod=(ll)1e9+7;
    
//int dp[SZ][SZ];
int arr[SZ][4];
int dp[SZ][4];
int n;
int solve(int r ,int prev ){

    if(r>=n){
        return 0;
    }
    int &ret=dp[r][prev];
    if(prev!=-1 && ret !=-1){
        return ret;
    }
    int mx=0;
    for(int i=0 ;i<3;i++){
        if(i==prev) continue;
        mx=max(mx,arr[r][i]+solve(r+1,i));
    }
    return ret=mx;
}

int main() {
//#ifdef CLION
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdin);
//#endif
    
    cin>>n;
    for(int i=0 ;i<n ;i++){
       cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
    memset(dp,-1,sizeof(dp));
    cout<<solve(0,-1)<<endl;
    return 0;
}
 

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

const ll mod = 998244353;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

ll dp[3010][3010][3][3];
ll inv2 = 499122177;

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    ll H = C - A + 1;
    ll W = D - B + 1;

    dp[0][0][0][0] = 1;

    for (int i=1; i<H; ++i) {
        for (int j=0; j<3; ++j) {
            for (int k=0; k<3; ++k) {
                (dp[i][0][1][min(k+1, 2)] += dp[i-1][0][j][k]) %= mod;
                (dp[i][0][1][k] += (dp[i-1][0][j][k] * (B - 1)) % mod) %= mod;
            }
        }
    }

    for (int i=1; i<W; ++i) {
        for (int j=0; j<3; ++j) {
            for (int k=0; k<3; ++k) {
                (dp[0][i][min(j+1, 2)][1] += dp[0][i-1][j][k]) %= mod;
                (dp[0][i][j][1] += (dp[0][i-1][j][k] * (A - 1)) % mod) %= mod;
            }
        }
    }

    for (int i=1; i<H; ++i) {
        for (int j=1; j<W; ++j) {
            for (int k=0; k<3; ++k) {
                for (int l=0; l<3; ++l) {
                    // 行を増やす
                    (dp[i][j][1][min(l+1, 2)] += dp[i-1][j][k][l]) %= mod;
                    (dp[i][j][1][l] += (dp[i-1][j][k][l] * (B + j - 1)) % mod) %= mod;

                    // 列を増やす
                    (dp[i][j][min(k+1, 2)][1] += dp[i][j-1][k][l]) %= mod;
                    (dp[i][j][k][1] += (dp[i][j-1][k][l] * (A + i - 1)) % mod) %= mod;
                }
            }
            (dp[i][j][1][1] *= inv2) %= mod;
        }
    }

    // for (int i=0; i<H; ++i) {
    //     for (int j=0; j<W; ++j) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    ll res = 0;
    for (int i=0; i<3; ++i) {
        for (int j=0; j<3; ++j) {
            (res += dp[H-1][W-1][i][j]) %= mod;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 638516
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  [h, w, a, b] <- getIntList
  let s = BS.replicate a '0' `BS.append` BS.replicate (w-a) '1'
  let s' = BS.replicate a '1' `BS.append` BS.replicate (w-a) '0'
  replicateM_ b $ BS.putStrLn s
  replicateM_ (h-b) $ BS.putStrLn s'

-- IO
readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

getInt :: IO Int
getInt = fst . fromJust . readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr readInt <$> BS.getLine


Measured memory_bytes: 2044
#include <cstdio>

#define int long long
#define N 100010

int n;
int a[N];
int qwq,qaq;

signed main() {
	scanf("%lld",&n);
	for(int i=1;i<=n;++i)
		scanf("%lld",a+i);
	for(int i=1;i<=n;++i) {
		if(i&1) qwq+=a[i];
		else qwq-=a[i];
	}
	for(int i=1;i<=n;++i) {
		printf("%lld ",qwq);
		qwq=(a[i]<<1)-qwq;
	}
	return 0;
}

Measured memory_bytes: 2048
n = int(input())
a = list(map(int, input().split()))
lis = [0] * (max(a) + 1)
for i in a:
    lis[i] += 1
cnt = 0
for i in lis:
    cnt += max(0,i-1)
ans = len(set(a))
if cnt % 2 == 0:
    print(ans)
else:
    print(ans - 1)

Measured memory_bytes: 15012
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;

template<typename T = char>
vector<pair<T, int>> run_length_encode(string &a) {
    vector<pair<T, int>> res;
    for (T &ai: a) {
        if (res.empty() || res.back().first != ai) res.emplace_back(ai, 1);
        else res.back().second++;
    }
    return res;
}

int main() {
    int n; cin >> n;
    string s, t; cin >> s >> t;
    auto rle = run_length_encode(s);
    long long ans = 3 * rle[0].second;
    for (int i = 0; i + 1 < (int)rle.size(); i++) {
        int a = rle[i].second, b = rle[i + 1].second;
        if (a == 1 && b == 1) ans *= 2;
        if (a == 1 && b == 2) ans *= 2;
        if (a == 2 && b == 1) ans *= 1;
        if (a == 2 && b == 2) ans *= 3;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int iCase = 0;
	int a,b,c = 0;
	cin >> iCase;
	priority_queue<int,vector<int>,less<int> > que;

	while(iCase-- > 0 && cin >> a >> b >> c) {
		    
		que.push(a);
		que.push(b);
		que.push(c);

		int s1 = que.top(); que.pop();
		int s2 = que.top(); que.pop();
		int s3 = que.top(); que.pop();

		if (s3*s3 + s2*s2 == s1*s1)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

vector<vector<int>> g;

pair<int, int> dfs(int v, int p) {
  pair<int, int> res = {1, 1};
  bool first = true;
  bool rem = false;
  for (int u : g[v]) {
    if (u == p) continue;
    eprintf("%d -> %d\n", v, u);
    if (first) {
      res = dfs(u, v);
      first = false;
    } else {
      if (res.second == 1) {
        assert(res.first == 1);
        res.first = 0;
        rem = true;
      }
      auto in = dfs(u, v);
      res.first += in.first;
      res.second = false;
      if (!rem && in.second) {
        assert(in.first == 1);
        res.first -= in.first;
        rem = true;
      }
    }
  }
  eprintf("dfs(%d) = %d,%d\n", v, res.first, res.second);
  return res;
}

int main() {
#ifdef LOCAL
  freopen("e.in", "r", stdin);
  freopen("e.out", "w", stdout);
#endif

  int n;
  while (scanf("%d", &n) == 1) {
    g = vector<vector<int>>(n);

    for (int i = 0; i < n - 1; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      g[a].push_back(b);
      g[b].push_back(a);
    }

    int v = -1;
    for (int i = 0; i < n; i++) {
      if (g[i].size() >= 3) {
        v = i;
        break;
      }
    }
    if (v == -1) {
      printf("1\n");
    } else {
      pair<int, int> ans = dfs(v, -1);
      printf("%d\n", ans.first);
    }
  }

  return 0;
}


Measured memory_bytes: 9856
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int sx = scan.nextInt();
        int sy = scan.nextInt();
        int tx = scan.nextInt();
        int ty = scan.nextInt();
        StringBuilder sb = new StringBuilder();
        // s->t
        for (int x = sx; x < tx; x++) {
            sb.append('R');
        }
        for (int y = sy; y < ty; y++) {
            sb.append('U');
        }
        // t->s
        for (int x = tx; sx < x; x--) {
            sb.append('L');
        }
        for (int y = ty; sy < y; y--) {
            sb.append('D');
        }
        // s->t
        sb.append('D');
        for (int x = sx; x < tx+1; x++) {
            sb.append('R');
        }
        for (int y = sy-1; y < ty; y++) {
            sb.append('U');
        }
        sb.append('L');
        // t->s
        sb.append('U');
        for (int x = tx; sx-1 < x; x--) {
            sb.append('L');
        }
        for (int y = ty+1; sy < y; y--) {
            sb.append('D');
        }
        sb.append('R');
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

int main() {
	int n;
	cin >> n;
	while(n--) {
		string order, message;
		cin >> order >> message;
		for(int i=order.length()-1; i>=0; i--) {
			switch(order[i]) {
				case 'J':
					message = message[message.length()-1] + message.substr(0,message.length()-1);
					break;
				case 'C':
					message = message.substr(1,message.length()-1) + message[0];
					break;
				case 'E':
					if(message.length()%2) {
						message = message.substr(message.length()/2+1,message.length()/2) + message[message.length()/2] + message.substr(0,message.length()/2);
					} else {
						message = message.substr(message.length()/2,message.length()/2) + message.substr(0,message.length()/2);
					}
					break;
				case 'A':
					reverse(message.begin(), message.end());
					break;
				case 'P':
					for(int i=0; i<message.length(); i++) {
						if('0'<=message[i] && message[i]<='9') {
							message[i] = ((message[i]-'0'+9)%10)+'0';
						}
					}
					break;
				case 'M':
					for(int i=0; i<message.length(); i++) {
						if('0'<=message[i] && message[i]<='9') {
							message[i] = ((message[i]-'0'+1)%10)+'0';
						}
					}
					break;
			}
		}
		cout << message << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
/*********************
*  Author: xuziyuan  * 
*********************/
 
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <LL,LL>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair
 
using namespace std;
 
LL n,m,x,y,re[60],ans=0;
vector <pii> g[60];
vector <LL> pass;
bool ok;
 
void dfs(LL pos,LL to,LL no)
{
  if(pos==to)
  {
    ok=true;
    return;
  }
  rep(i,g[pos].size())
  {
    if(g[pos][i].fi==no) continue;
    pass.pb(g[pos][i].se);
    dfs(g[pos][i].fi,to,pos);
    if(ok) return;
    pass.pop_back();
  }
}
 
int main()
{
  cin>>n;
  rep(i,n-1)
  {
    cin>>x>>y;
    g[x].pb(mpr(y,i));
    g[y].pb(mpr(x,i));
  }
  cin>>m;
  rep(i,m)
  {
    cin>>x>>y;
    ok=false;
    dfs(x,y,0);
    rep(j,pass.size()) re[i]|=(LL)pow(2,pass[j]);
    pass.clear();
  }
  rep(i,(1<<m))
  {
    LL cnt=0,now=0;
    rep(j,m)
    {
      if((i&(1<<j))==0) continue;
      now|=re[j];
      cnt++;
    }
    LL c=0;
    while(now>0)
    {
      c+=now%2;
      now/=2;
    }
    if(cnt&1) ans-=(LL)pow(2,n-1-c);
    else ans+=(LL)pow(2,n-1-c);
  }
  cout<<ans<<endl;
  return 0;
}

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

bool isPrime(ll x){
    if(x == 2) return true;
    if(x < 2 or x % 2 == 0) return false;

    for(ll i = 3; i <= sqrt(x); i+=2){
        if(x % i == 0) return false;
    }
    return true;
}


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

    ll x;
    cin >> x;

    ll ans = x;
    for(ll i = x;; i++){
        if(isPrime(i)){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, m = (int(i) for i in raw_input().split())
switches = []
for i in range(m):
    line = [int(i) for i in raw_input().split()]
    switches.append(line[1:]) 
ps = [int(i) for i in raw_input().split()]
ans = 0
for i in range(2 ** n):
    pattern = []
    for d in range(n):
        if (1 << d) & i:
            pattern.append(True)
        else:
            pattern.append(False)

    ok = True
    for j in range(m):
        count = 0
        for k in switches[j]:
            if pattern[k-1]:
                count += 1
        ok = ok and (count % 2 == ps[j])
    if ok:
        ans += 1
print ans


Measured memory_bytes: 2692
#include <cstdio>

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


Measured memory_bytes: 2592
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = long long;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

ll mod(double a, double b){
	return a - floor(a / b) * b;
}

int main(){
	IOS;
	ll n, M, m;
	cin >> n >> M >> m;
	vec<ll> a(n);
	REP(i,n){
		cin >> a[i];
	}
	ll ans;
	if(n >= 2) ans = max(abs(a[n - 1] - a[n - 2]),abs(a[n - 1] - m));
	else ans = abs(a[0] - m);
	dump(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int a, b;
    cin >> a >> b;
    int total = 1;
    int ans = 0;
    while (total < b)
    {
        ans++;
        total += a - 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n,m;cin>>n>>m;
  int ans=(n-1)*(m-1);
  cout(ans);
  
  return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
}


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

using namespace std;

#define int long long

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust";
    else cout << "win";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
K=int(input())
nana=7
count=1
if K==7:
  print(1)
  exit()
if K==1:
  print(1)
  exit()
for i in range(5*10**6):
  count+=1
  nana=(nana*10+7)%K
  if nana==0:
    print(count)
    exit()

print(-1)

Measured memory_bytes: 9128
#! python3
#  solve_122B.py

S = input()

t = [0]*len(S)

if S[0] in ["A","C","G","T"]:
    t[0] = 1

for i in range(1,len(S)):
    if S[i] in ["A","C","T","G"]:
        t[i] = t[i-1] + 1
    else:
        t[i] = 0

print(max(t))

Measured memory_bytes: 9068
n = gets.to_i
c, p = n.times.map{gets.chomp.split}.transpose
city = Array.new(0)
for i in 0..(n-1)
  city.push(c[i])
end
city.uniq!
city.sort!
city.each do |ci|
  po = Array.new(0)
  for i in 0..(n-1)
    if c[i] == ci
      po.push([p[i].to_i, i+1])
    end
  end
  po.sort!{|n1, n2| n2[0] <=> n1[0]}
  po.each do |ar|
    puts ar[1]
  end
end

Measured memory_bytes: 1788
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**13
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,m = LI()
    s = S()
    t = S()
    l = n * m // fractions.gcd(n,m)
    si = ti = 0
    sc = l // n
    tc = l // m
    while si < l and ti < l:
        if si == ti:
            if s[si//sc] != t[ti//tc]:
                return -1
            si += sc
            ti += tc
        elif si < ti:
            si += sc
        else:
            ti += tc

    return l


print(main())


Measured memory_bytes: 5708
package main

import "fmt"

func main() {
	var D, G int
	fmt.Scan(&D, &G)

	p := make([]int, D)
	c := make([]int, D)
	for i := range p {
		fmt.Scan(&p[i], &c[i])
	}

	minCnt := 0
	for bit := 0; bit <= 1<<uint(D); bit++ {
		ans := 0
		cnt := 0
		for i := 0; i < D; i++ {
			if bit&(1<<uint(i)) == (1 << uint(i)) {
				cnt += p[i]
				ans += p[i]*100*(i+1) + c[i]
			}
		}
		// fmt.Println(cnt, ans)
		if ans >= G && (minCnt == 0 || cnt < minCnt) {
			minCnt = cnt
		} else {
			for i := D - 1; i >= 0; i-- {
				if bit&(1<<uint(i)) == (0 << uint(i)) {
					for j := 0; j < p[i]; j++ {
						cnt++
						ans += 100 * (i + 1)
						if ans >= G && (minCnt == 0 || cnt < minCnt) {
							minCnt = cnt
							break
						}
					}
					// TODO: check complete point
				}
				if ans >= G {
					break
				}
			}
		}
	}
	fmt.Println(minCnt)
}


Measured memory_bytes: 512