akhauriyash/Code-Regression huggingface dataset:
/////////////////////////////////////////////////
//                                             //
//                 _ooOoo_                     //
//                o8888888o                    //
//                88" . "88                    //
//                (| -_- |)                    //
//             ____/`---'\\____                //
//           .'  \|     |//  `.                //
//           /  \|||  :  |||// \               //
//          /  _||||| -:- |||||- \             //
//          |   | \\  -  /// |   |             //
//          | \_|  ''\---/''  |  |             //
//          \  .-\__  `-`  ___/-. /            //
//         ___`. .'  /--.--\  `. . __          //
//      ."" '<  `.___\_<|>_/___.'  >'"".       //
//     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     //
//     \  \ `-.   \_ __\ /__ _/   .-` /  /     //
//=====`-.____`-.___\_____/___.-`____.-'=======//
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^//
//.............................................//
/////////////////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll modn=998244353;
const ll INF = 0x3f3f3f3f;
vector<int> ans[3];
set<int> st;
int main(){
    int n,k;
    scanf("%d%d",&k,&n);
    for(int i=0;i<k;i++)ans[0].push_back(n+i);
    int cnt1=0;
    for(int i=0;i<k;i+=2){ans[1].push_back(n+k+i);}
    for(int i=1;i<k;i+=2){ans[1].push_back(n+k+i);cnt1++;}
    reverse(ans[1].begin(),ans[1].end());
    for(int i=cnt1-1;i>=0;i--)ans[2].push_back(n+2*k+i);
    for(int i=k-1;i>=cnt1;i--)ans[2].push_back(n+2*k+i);
    int flag = 0;
    for(int i=0;i<k;i++){
        if(ans[0][i]+ans[1][i]>ans[2][i]){
            printf("-1\n");
            return 0;
        }
    }
    for(int i=0;i<k;i++)
        printf("%d %d %d\n",ans[0][i],ans[1][i],ans[2][i]);

    return 0;
}
/*
5
1 2 3 4 5
5 3 2 1 4
*/


Measured memory_bytes: 3576
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())
S = []
for n in range(N):
    S_n = input()
    S.append(S_n)

# 求解処理
judge = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for s in S:
    judge[s] += 1

# 結果出力
for k, v in judge.items():
    print(k, "x", v)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int m, d;
  cin >> m >> d;
  int ans = 0;
  reps(i, d) {
    if (i >= 10 && i <= 99) {
      int d1 = i % 10;
      int d2 = (i / 10) % 10;
      if (d1 >= 2 && d2 >= 2 && d1 * d2 >= 1 && d1 * d2 <= m) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
 *  Author : Jun_SH
 *  Solution for ABC 146 A
 */
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
string table[10]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    int t;
    for(int i=0;i<7;++i){
        if(s==table[i]){
            t=i;
        }
    }
    t++;
    t%=7;
    cout<<7-t<<endl;

}


Measured memory_bytes: 256
from collections import Counter

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

mem = Counter(d)

if d[0] != 0 or mem[0] != 1:
  print(0)
  exit()

count = 1
for i in range(max(d)):
  count = count * mem[i] ** mem[i+1]
  count = count % 998244353

print(count)


Measured memory_bytes: 19936
function Main(input){
	function a(b){
  	if(b == 1){
    	return "9";
    }
  	if(b == 9){
    	return "1";
    }
    return b;
  }
	
	h = a(input[0]) + a(input[1]) + a(input[2]);
  
  return h;
}

console.log(Main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>
#define NMAX 105
#define WMAX 10005

using namespace std;

struct Item {
	int value;
	int weight;
};

int N, W;
Item items[NMAX + 1];
int C[NMAX + 1][WMAX + 1];

void compute(int &maxValue, vector<int> &selection) {
	for (int w = 0; w <= W; w++) {
		C[0][w] = 0;
	}
	for (int i = 1; i <= N; i++) C[i][0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int w = 1; w <= W; w++) {
			C[i][w] = C[i - 1][w];
			if (items[i].weight > w) continue;
			if (items[i].value + C[i - 1][w - items[i].weight] > C[i - 1][w]) {
				C[i][w] = items[i].value + C[i - 1][w - items[i].weight];
			}
		}
	}
	maxValue = C[N][W];
}

void input() {
	cin >> N >> W;
	for (int i = 1; i <= N; i++) {
		cin >> items[i].value >> items[i].weight;
	}
}

int main() {
	int maxValue;
	vector<int> selection;
	input();
	compute(maxValue, selection);

	cout << maxValue << endl;

	return 0;
}


Measured memory_bytes: 7044
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int k;
	cin >> k;
	ll ans = 0;
	for(int i = 1; i <= k; i++)
		for(int j = 1; j <= k; j++)
			for(int l = 1; l <= k; l++)
				ans += __gcd(i, __gcd(j, l));

	cout << ans << endl;			
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main(){
	ll h,w,mod=pow(10,9)+7;
	cin>>h>>w;
	vector<string> a(h);
	vector<vector<ll>> ans(h,vector<ll>(w,0));
	for(int i=0;i<h;i++)
	cin>>a[i];
	ans[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(a[i][j]=='#')
			continue;
			if((i+1)<h)
			ans[i+1][j]=(ans[i+1][j]%mod+ans[i][j]%mod)%mod;
			if((j+1)<w)
			ans[i][j+1]=(ans[i][j+1]%mod+ans[i][j]%mod)%mod;
		}
	}
	cout<<ans[h-1][w-1]<<endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll cnt = 0;
    ll s = accumulate(A.begin(), A.end(), 0LL);
    rep(i, N) {
        if (A[i] * 4 * M >= s) cnt++;
    }
    if (cnt >= M) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
}

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


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

const int INF = pow(2, 31) - 1;
#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  ll N;
  cin >> N;
  vector<ll> x(N), y(N), h(N);
  REP(i, N) {
    cin >> x[i] >> y[i] >> h[i];
  }
  ll x_pr, y_pr, h_pr;
  REP(i, N) {
    if(h[i] > 0) {
      x_pr = x[i];
      y_pr = y[i];
      h_pr = h[i];
      break;
    }
  }
  FOR(cx, 0, 100) {
    FOR(cy, 0, 100) {
      ll H = h_pr + abs(x_pr - cx) + abs(y_pr - cy);
      bool flag = true;
      REP(i, N) {
        if(max(H - abs(x[i] - cx) - abs(y[i] - cy), (ll)0) != h[i]) {
          flag = false;
          break;
        }
      }
      if(flag == true) {
        cout << cx << " " << cy << " " << H << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
from sys import stdin


def chmin(a,b):
    if a > b: return b
    else: return a


def chmax(a,b):
    if a < b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    A_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    A_arr_wloc = []
    for i,A in enumerate(A_arr):
        A_arr_wloc.append([A,i])
    A_arr_wloc.sort(reverse=True)
    dp = [[0] * (N+1) for _ in range(N+1)]
    for i in range(N):
        for j in range(N-i):
            dp[i+1][j] = chmax(dp[i+1][j], dp[i][j]+A_arr_wloc[i+j][0]*(A_arr_wloc[i+j][1]-i)) # left
            dp[i][j+1] = chmax(dp[i][j+1], dp[i][j]+A_arr_wloc[i+j][0]*((N-1-j)-A_arr_wloc[i+j][1])) # right
    cnt = 0
    for i in range(0,N+1):
        cnt = chmax(cnt, dp[i][N-i])
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 100320
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

typedef long long int ll;
typedef vector<ll> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int modi = 1e9 + 7;

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

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

void solve(){
	int n;
	cin >> n;
	ll a[n];
	for(int i =0;i<n;i++)
		cin >> a[i];
	// reduce all to its smaller form
	map<int,int> lcm_factors;
	for(int i =0;i<n;i++){
		ll val = a[i];
		for(int j = 2;j*j<=val;j++){
			if(val%j == 0){
				int cnt = 0;
				while(val%j==0){
					cnt++;
					val/=j;
				}
				if(lcm_factors.count(j))
					lcm_factors[j] = max(lcm_factors[j],cnt);
				else
					lcm_factors[j] = cnt;
			}
		}
		if(val>1){
			if(lcm_factors.count(val))
			lcm_factors[val] = max(lcm_factors[val],1);
 			else
 				lcm_factors[val] = 1;
 		}
	}
	ll lcm = 1;
	for(auto e:lcm_factors){
		lcm = lcm*binpow(e.first,e.second)%modi;
	}
	// for(auto e:lcm_factors){
	// 	cout << e.first <<  " " << e.second << endl;
	// }
	ll ans = 0;
	for(int i =0;i<n;i++){
		ans = (ans+binpow(a[i],modi-2))%modi;
	}
	ans = ans*lcm%modi;
	cout << ans << endl;
}

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

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool ans = false;
  for (int i=0; i<s.size(); i++){//要素数 イテレータ自体が問題ならこれでよい、iという数が問題なら変えるべき
    if (s.at(i) == '7'){
      ans = true;
    }
  }
  if (ans){
    cout << "Yes"s << endl;
  }
  else{
    cout << "No"s << endl;
  }
}
      

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int ygcd(int a, int b) 

{ 

 if (a == 0) 

 return b; 

 return ygcd(b % a, a); 

} 

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    long long int s=0;
    int gcd;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                
                s+=ygcd(i,ygcd(j,k));
            }
        }
    }
    cout<<s<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>

using namespace std;

void showIntArray(int a[], int n) {
  for (int i=0; i<n; i++) {
    cout << a[i] << ' ';
  } cout << endl;
}

long long int xor_count1(string s) {
  long long int c = 0;
  char tmp;
  for (int i=0; i<s.size(); i++) {
    if (i % 2 == 0) {
      tmp = '0';
    } else {
      tmp = '1';
    }
    if (tmp != s[i]) {
      c++;
    }
  }
  return c;
}

long long int xor_count2(string s) {
  long long int c = 0;
  char tmp;
  for (int i=0; i<s.size(); i++) {
    if (i % 2 == 0) {
      tmp = '1';
    } else {
      tmp = '0';
    }
    if (tmp != s[i]) {
      c++;
    }
  }
  return c;
}

int main() {
  string s, s1;
  long long int tmp;
  getline(cin, s);

  // for (int i=0; i<s.size(); i++) {
  //   if (i % 2 == 0) {
  //     s1[i] = '0';
  //   } else {
  //     s1[i] = '1';
  //   }
  // }

  // tmp = xor_count(s, s1);

  // for (int i=0; i<s.size(); i++) {
  //   if (i % 2 == 0) {
  //     s1[i] = '1';
  //   } else {
  //     s1[i] = '0';
  //   }
  // }

  cout << min(xor_count1(s), xor_count2(s)) << endl;

  // cout << s1 << endl;
  // cout << s2 << endl;

  // for (int i=0; i<s.size(); i++) {
  //   cout << s2[i] << endl;
  // }
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main()
{
 //   io
    int n, m;
    cin >> n >> m;
    bool dig[n+1] = {false};
    int grid[m][2];
    for(int i = 0; i < m; i++)
    {
        int s,c;
        cin >> s >> c;
        grid[i][0] = s;
        grid[i][1] = c;
    }
    int *arr = new int[n+1]();
    int flag = 0;
    for(int i = 0; i < m; i++)
    {
        int pos = grid[i][0],val = grid[i][1];
        if(n!=1)
        {
            if(pos == 1 && val == 0)
            {
                flag = 1;
                break;
            }
        }
            if(!dig[pos])
            {
                arr[pos] = val;
                dig[pos] = true;
  //              cout << pos << " " << arr[pos];
            }
            else if(dig[pos] && val!=arr[pos])
            {
                flag = 1;
                break;
            }
    }
    if(flag)
        cout << "-1\n";
    else{
      if(n > 1 && !dig[1])
        arr[1] = 1;
        for(int i = 1; i <= n; i++)
            cout << arr[i];
        cout << "\n";
    }
    return 0;
}

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

int main() {
	int K;
	string a;

	cin >> K >> a;

	int alang = a.length();

	if (alang <= K)
	{
		cout << a << endl;
	}
	else
	{
		cout << a.substr(0, K) << "..." << endl;
	}
}

Measured memory_bytes: 3628
# 解説放送

def pow2(n, mod):
    """2のn乗まで"""
    t = 1
    yield t
    for _ in range(n):
        t = t * 2 % mod
        yield t


def main():
    MOD = 10 ** 9 + 7

    N = int(input())
    *c, = map(int, input().split())

    c.sort()

    *two, = pow2(N, MOD)

    ans = 0
    for l, x in enumerate(c):
        # x:=係数.この位置の操作にかかるコストの総和を求める.
        # r:=xの右側にある要素数
        # (1<<r)個の状態を行として並べて,列で不一致数を確認すると,どの列も状態の半分が不一致.これがr列ある.
        r = N - l - 1

        t = two[r]
        if r != 0:
            t = (t + two[r - 1] * r) % MOD  # 右側の個数
        t = t * two[l] % MOD
        t = t * x % MOD
        ans = (ans + t) % MOD  # MOD忘れ

    ans = ans * two[N] % MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    // input
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    bool x[3001] = {}, y[3001] = {};
    // all combination available with a & b
    for (int i = 0; 100 * a * i <= f; i++) {
        for (int j = 0; 100 * a * i + 100 * b * j <= f; j++) {
            x[100 * a * i + 100 * b * j] = true;
        }
    }
    // all combination available with c & d
    for (int i = 0; c * i <= f; i++) {
        for (int j = 0; c * i + d * j <= f; j++) {
            y[c * i + d * j] = true;
        }
    }
    int ans1 = 100 * a, ans2 = 0;
    for (int i = 0; i <= f; i++) {
        for (int j = 0; j <= f; j++) {
            if (x[i] && y[j] && ans2 * (i + j) < j * ans1 && j * (e + 100) <= (i + j) * e && i + j <= f) {
                ans1 = i + j;
                ans2 = j;
            }
        }
    }
    printf("%d %d\n", ans1, ans2);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
using namespace std;
using ll = long long;

int main(void) {
    int c[3][3];
    rep (i, 3) rep (j, 3) cin >> c[i][j];

    
    if ((c[0][0] - c[1][0]) == (c[0][1] - c[1][1]) && (c[0][1] - c[1][1]) == (c[0][2] - c[1][2]) &&
         (c[2][0] - c[1][0]) == (c[2][1] - c[1][1]) && (c[2][1] - c[1][1]) == (c[2][2] - c[1][2]) &&
         (c[2][0] - c[0][0]) == (c[2][1] - c[0][1]) && (c[2][1] - c[0][1]) == (c[2][2] - c[0][2])) {
             cout << "Yes" << endl;
         }
    else cout << "No" << endl;    
    return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
s=input()
answer = True
for i in range(a):
    # print(s[i])
    if s[i] == '-':
        answer = False
if s[a] != '-':
    answer = False
for j in range(b):
    # print(s[a+1+j])
    if s[a+1+j] == '-':
        answer = False
        
if answer:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <sstream>
#define ull unsigned long long
#define ll long long
#define INF 1000000007
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    if((a<0 && b>0) || (a<0 && b==0) || (a==0 && b>0) || (a==0 && b==0)){
        cout << "Zero" << endl;
    }
    else if(a<0 && b<0){
        if((abs(b-a)+1)%2==0){
            cout << "Positive" << endl;
        }
        else if((abs(b-a)+1)%2==1){
            cout << "Negative" << endl;
        }
    }
    else if(a>0 && b>0){
        cout << "Positive" << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

// }}}
/* vim:set foldmethod=marker: */

void solve(){
    int a,b,c;
    cin >> a >> b >> c;

    if (b-a == c-b) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }

// 文字列の検索
// string s="abc";
// if (s.find('d') == string::npos){
//     cout << "find" << endl;
// }else{
//     cout << "not find" << endl;
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll n,m,l;
	cin>>n>>m>>l;
	vector<VL> dp(305,VL(305,mod)),dist(305,VL(305,mod));
	fr(i,0,m)
	{
		ll a,b,c;
		cin>>a>>b>>c;
		dp[a][b]=c;
		dp[b][a]=c;
	}
	fr(i,1,n+1)
	{
		dp[i][i]=0;
		dist[i][i]=0;
	}
	for(int k=1;k<=n;k++)
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
			}
		}
	}
	fr(i,1,n+1)
	{
		fr(j,1,n+1)
		{
			if(i==j)
				continue;
			if(dp[i][j]<=l)
				dist[i][j]=min(dist[i][j],1LL);
		}
	}
	for(int k=1;k<=n;k++)
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}
	ll q;
	cin>>q;
	fr(i,0,q)
	{
		ll a,b;
		cin>>a>>b;
		if(dist[a][b]==mod)
			cout<<-1<<endl;
		else
		{	
		ll ans;
		// if(dist[a][b]<=l)
		// 	ans=0;
		// else
			ans=ceil((double)dist[a][b]/(double)l)-1;
			//ll ans=dp[a][b]/l;
		cout<<dist[a][b]-1<<endl;
		//cout<<a<<" -> "<<b<<" = "<<dp[a][b]<<" : "<<ans<<endl;
		}

	}
	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int ans = N / 1.08;
  int new_ans = ans;
  
  string flag = "No";
  for (int i = ans-100; i < ans+100; i++) {
      if (floor(i * 1.08)==N) {
          new_ans = i;
          flag = "Yes";
          break;
      }
  }
  
  if (flag == "Yes") cout << new_ans << endl;
  else cout << ":(" << endl;
  
}

Measured memory_bytes: 256
#include <cstdio>

int N, M;
int A[310][310];
int del[310];
int num[310];
int pos[310];
int res;

void solve()
{
	int i, j, k;
	res = 1000;
	for(i=0; i<M; i++){
		for(j=1; j<=M; j++)
			num[j] = 0;
		for(j=0; j<N; j++){
			num[A[j][pos[j]] ] ++;
		}
		int mx = 0;
		for(j=1; j<=M; j++){//j=1
			if(mx < num[j])
				mx = num[j];
		}
		if(res > mx)
			res = mx;
		int cnt = 0;
		for(j=1; j<=M; j++){
			if(num[j] == mx){
				del[j] = 1;
				for(k=0; k<N; k++){
					if(A[k][pos[k]] == j){
						while(del[A[k][pos[k]]] == 1)
							pos[k] ++;
					}
				}
				cnt ++;
			}
		}
		i += cnt-1;
	}
	printf("%d\n", res);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i, j;
	scanf("%d%d", &N, &M);
	for(i=0; i<N; i++){
		for(j=0; j<M; j++)
			scanf("%d", &A[i][j]);
	}
	solve();
	return 0;
}

Measured memory_bytes: 512
n, m = map(int, input().split())
dp=[0]*(n+1)
e=[ set() for _ in range(n+1)]
for _ in range(m):
    a, b = map(int, input().split())
    e[a].add(b)
    dp[b]+=1

q=[0]*(n+1)
j=0
for z in range(len(dp)):
    if dp[z]==0:
        q[j]=z
        j=j+1
color=0
i=1
while i<j:
    end=j
    for qel in range(i, end):
        for w in e[q[qel]]:
            dp[w]-=1
            if dp[w]==0: 
                q[j]=w
                j=j+1
    i=end
    color=color+1

print(color-1)

Measured memory_bytes: 32284
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int mod=(1e9)+7;
const int maxn=5010;
int n,a,b,dp[maxn][2],f[maxn][2],g[maxn],ans,tmp;
int ksm(int x,int y) {
	int res=1;
	while (y) {
		if (y&1) res=(ll)res*x%mod;
		x=(ll)x*x%mod; y>>=1;
	} return res;
}
void update(int &x,int y) {
	x+=y; if (x>=mod) x-=mod;
}
int main() {
//	freopen("1.txt","r",stdin);
	read(n); read(a); read(b);
	if (a>b) swap(a,b);
	if (b==1) { printf("%d\n",ksm(2,n)); return 0; }
	f[0][0]=f[0][1]=1;
	for (int i=1;i<=n;i++)
	for (int k=0;k<=1;k++)
	for (int j=1;j<=i;j++) {
		if (!k&&j<a) continue;
		update(f[i][k],f[i-j][k^1]);
	}
	g[0]=1;
	for (int i=1;i<=n;i++) g[i]=(f[i][0]+f[i][1])%mod;
	//for (int i=1;i<=n;i++) printf("%d ",g[i]); printf("\n");
	for (int i=1;i<n;i++) {
		if (i<a) update(dp[i][0],1);
		for (int j=1;j<min(i,a);j++) update(dp[i][0],dp[i-j][1]);
		
		if (i<b) update(dp[i][1],g[i-1]);
		for (int j=1;j<min(i,b);j++) {
			if (j==1) update(dp[i][1],dp[i-j][0]);
			else update(dp[i][1],(ll)dp[i-j][0]*g[j-2]%mod);
		}
		
		if (n-i<b) update(ans,(ll)dp[i][0]*g[n-i-1]%mod);
		if (n-i<a) update(ans,(ll)dp[i][1]);
	//	printf("%d %d %d\n",i,dp[i][0],dp[i][1],ans);
	}
//	printf("%d %d\n",ksm(2,n),ans);
	printf("%d\n",(ksm(2,n)-ans+mod)%mod);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 3868
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
using namespace std;


int main(){
  int n;
  cin >> n;
  long long power = 1;
  long long q = pow(10, 9) + 7;
  for(int i = 1; i <= n; i++){
    power *= i;
    power %= q;
  }
  cout << power << endl;

}

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

int main(){
  int N;
  cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++){cin>>v[i];v[i]--;}
  std::vector<int> a(100000,0),b(100000,0);
  for(int i=0;i<N;i++){
    if(i%2)a[v[i]]++;
    else b[v[i]]++;
  }
  int k,m,kk,mm;
  k=kk=0;
  for(int i=0;i<100000;i++){
    if(k<a[i]){k=a[i];m=i;}
    if(kk<b[i]){kk=b[i];mm=i;}
  }
  //cout<<k<<kk<<m<<mm<<endl;
  if(m!=mm)cout<<N-k-kk<<endl;
  else{
    if(k==N/2&&kk==N/2)cout<<N/2<<endl;
  else{
    int kx,kkx,mx,mmx;
    kx=kkx=0;
    for(int i=0;i<N;i++){
      if(kx<a[i]&&m!=i){kx=a[i];mx=i;}
      if(kkx<b[i]&&mm!=i){kkx=b[i];mmx=i;}
    }
    cout<<N-max(k+kkx,kk+kx)<<endl;
  }
}
}


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

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

    int cnt = 0;
    for (int i = 0; i <= A; i++)
    {
        for (int j = 0; j <= B; j++)
        {
            for (int k = 0; k <= C; k++)
            {
//                cout << A*i + B*j + C*k  << endl;
                if(500*i + 100*j + 50*k == X) cnt++;
            }
            
        }
        
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	bool flag = 1;
	for (int i = 0; i < s.length(); ++i) {
		if (i % 2 == 1 && s[i] == 'R')
			flag = false;
		if (i % 2 == 0 && s[i] == 'L')
			flag = false;
	}
	cout << (flag? "Yes": "No") << '\n';
	return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7
N = int(input())
C = [int(input()) for i in range(N)]
dp = [0] * (N+1)
dp_c = [0] * (2*10**5+1)
pred_ci = 0
dp[0] = 1
for i, ci in enumerate(C, 1):
    if pred_ci == ci:
        dp[i] += dp[i-1]
        continue
    dp[i] = (dp[i-1] + dp_c[ci]) % MOD
    dp_c[ci] = dp[i]
    pred_ci = ci

print(dp[N])

Measured memory_bytes: 90660
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <cctype>
using namespace std;
typedef long long ll;
typedef vector<int> veci;
typedef vector<ll> vecl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template <class T>
inline void read(T &ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return ;
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1:1;
    ret = (c == '-') ? 0:(c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return ;
}
inline void outi(int x) {if (x > 9) outi(x / 10);putchar(x % 10 + '0');}
inline void outl(ll x) {if (x > 9) outl(x / 10);putchar(x % 10 + '0');}

int n,m;
const int N=1e5+7;
int x,y;
int parent[N];
using namespace std;
void Init()
{
    for(int i = 1;i <= n;i++)
        parent[i] = i;
    return;
}

int get_boss(int v)
{
    if(parent[v] == v)
        return v;
    else
    {
        //路径压缩(使搜索祖宗的过程中，路径中搜索的结点的父亲的变为祖宗)
        parent[v] = get_boss(parent[v]);
        return parent[v];
    }
}

void Merge(int v,int u)
{
    int t1 = get_boss(v);
    int t2 = get_boss(u);
    parent[t2] = t1;
    return;
}
int main()
{
    int cnt=0;
    cin>>n>>m;
    Init();
    for(int i=1;i<=m;i++)
    {
        cin>>x>>y;
        Merge(x,y);
    }
    for(int i=1;i<=n;i++)
    {
       // cout<<parent[i]<<" ";
        if(parent[i]==i)
            cnt++;
    }
    cout<<cnt-1<<endl;
}


Measured memory_bytes: 4028
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

for s in sys.stdin:
    for i in range(26):
        state = list(s.strip())
        j = 0
        for d in state:
            if 'a' <= d and d <= 'z':
                state[j] = chr((ord(d) + i - ord('a')) % 26 + ord('a'))
            elif 'A' <= d and d <= 'Z':
                state[j] = chr((ord(d) + i - ord('A')) % 26 + ord('A'))
            j += 1

        state = "".join(state)

        if "the" in state or "this" in state or "that" in state:
            print(state)
            break

Measured memory_bytes: 6788
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X, t = list(map(int, sys.stdin.buffer.readline().decode().split()))
    print(max(0,X-t))


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	long long a,b,c,d;
	t = 1;
	while(t--) {
	 cin >> a >> b >> c >> d;
	 cout << (b - a + 1 - b / c + (a - 1) / c - b / d + (a - 1) / d + (b) / ((c * d) / __gcd(c, d)) - (a - 1) / ((c * d) / __gcd(c, d))) << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
#include <x86intrin.h>
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = (1e6) + 5;
char str[N];
int sum[N];
const int offset = 250005;
int mod1,mod2;
int prime(int k) {
	for (int i = 2;1ll * i * i <= k;++i)
		if (!(k % i))
			return 0;
	return 1;
}
int P1[N];
int P2[N];
int pow(int a,int b,int mod) {
	int ans = 1;
	while (b) {
		if (b & 1)
			ans = (1ll * ans * a) % mod;
		b /= 2;
		a = (1ll * a * a) % mod;
	}
	return ans;
}
const int base1 = 1e6 + 3;
const int base2 = 666013;
int pw1[N];
int pw2[N];
map < pii , int > M;
int main(void) {
	int n;
	srand(__rdtsc());
	cin>>n;
	cin>>(str + 1);
	sum[0] = offset;
	for (int i = 1;i <= n;++i) {
		sum[i] = sum[i - 1] + (str[i] == '<' ? -1 : str[i] == '>' ? 1 : 0);
	}
	do {	
		mod1 = ((1ll * rand() << 16) ^ rand()) & ((1ll << 30) - 1);
		if (mod1 < (1 << 29))
			mod1 += (1 << 29);
	} while (!prime(mod1));
    do {	
		mod2 = ((1ll * rand() << 16) ^ rand()) & ((1ll << 30) - 1);
		if (mod2 < (1 << 29))
			mod2 += (1 << 29);
	} while (!prime(mod2));
	const int iv1 = pow(base1,mod1 - 2,mod1);
	const int iv2 = pow(base2,mod2 - 2,mod2);
	pw1[offset] = pw2[offset] = 1;
	for (int i = offset - 1;i >= 0;--i) {
		pw1[i] = (1ll * pw1[i + 1] * iv1) % mod1;
		pw2[i] = (1ll * pw2[i + 1] * iv2) % mod2;
	}
	for (int i = offset + 1;i <= 2 * offset;++i) {
		pw1[i] = (1ll * pw1[i - 1] * base1) % mod1;
		pw2[i] = (1ll * pw2[i - 1] * base2) % mod2;
	}
	P1[0] = 0;
	P2[0] = 0;
	for (int i = 1;i <= n;++i) {
		if (sum[i] != sum[i - 1])
			P1[i] = P1[i - 1],
			P2[i] = P2[i - 1];
		else {
			int cnt1 = pw1[sum[i]];
			if (str[i] == '-')
				cnt1 = (mod1 - cnt1) % mod1;
			P1[i] = (P1[i - 1] + cnt1) % mod1;
			int cnt2 = pw2[sum[i]];
			if (str[i] == '-')
				cnt2 = (mod2 - cnt2) % mod2;
			P2[i] = (P2[i - 1] + cnt2) % mod2;
		}
	}
	ll ans = 0; 	
	for (int i = n;i >= 0;--i) {
 		int cnt1 = (P1[i] + 1ll * P1[n] * pw1[sum[i]]) % mod1;
 		int cnt2 = (P2[i] + 1ll * P2[n] * pw2[sum[i]]) % mod2;
 		if (M.count(mp(cnt1,cnt2)))
 			ans += M[mp(cnt1,cnt2)];
 		++M[mp(P1[i],P2[i])];
 	}
 	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 36224
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
using namespace std;
typedef long long ll;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_N = 2e5;

int c[10][10];

int main() {
    int N;
    cin >> N;
    rep(i,N+1) {
        string num = to_string(i);
        int h = num[0] - '0';
        int t = num[(int)num.length() - 1] - '0';
        if(h == 0 || t == 0) continue;
        ++c[h][t];
    }
    ll ans = 0;
    repi(i,1,10) {
        repi(j,1,10) {
            ans += c[i][j] * c[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
  ll n;
  cin>>n;
  ll a[n],sum=0,p=0,q=0;
  for(ll i=0;i<n;i++)
    cin>>a[i],sum+=a[i],q+=a[i]*a[i];
  
   ll x,y;
  p=sum/n;
  if(sum%n !=0)x=p+1;
  else
    x=p;

  ll ans=q+n*x*x-2*x*(sum);
  ans=min(ans,q+n*p*p-2*p*sum);
  cout<<ans;
  
  
 
  
  
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int K,X;
  cin >> K >> X;
  
  if(K == 1){
    cout << X <<endl;
  }else{
  
  int a,b;
  
  for(int i = 0 ; i < K ; i++ ){
    
    if(X - K + 1 + i< -1000000){
      continue;
    }else{
      a = X - K + 1 + i;
      break;
    }
  }
  
  for(int i = 0 ; i < K ; i--){
    
    if(X + K - 1 - i > 1000000){
      continue;
    }else{
      b = X + K - 1 - i;
      break;
    }
  }
  
  for(int i = a ; i < b + 1 ; i++){
    
    cout << i <<' ';
  }
  }
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    string s;
    cin >> s;
    bool ok = false;

    for (int i = 0; i < 2; ++i) {
        if (s[i] != s[i+1])
            ok = true;
    }

    cout << (ok?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
L = [0]*5
for i in range(N):
  S = input()
  if S[0] == 'M':
    L[0] += 1
  elif S[0] == 'A':
    L[1] += 1
  elif S[0] == 'R':
    L[2] += 1
  elif S[0] == 'C':
    L[3] += 1
  elif S[0] == 'H':
    L[4] += 1
K = list(itertools.combinations(L,3))
ans = 0
for i in range(len(K)):
  ans += K[i][0]*K[i][1]*K[i][2]
print(ans)

Measured memory_bytes: 3188
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pf = prime_factorize(N)
setpf = set(pf)

import collections
cpf = collections.Counter(pf)

cnt = 0
for i in setpf:
    tmp = cpf[i]
    for j in range(1,50):
        tmp -= j
        if tmp < 0:
            break
        else:
            cnt += 1
print(cnt)

Measured memory_bytes: 9460
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<s.size()-1;i++){
        if(s[i] != s[i+1]){
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}

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



int main(){
    int n;
    ll sum=0, ans=0;
    
    cin>> n;

    map<int, ll> a;
    for(int i=0; i<n; i++){
        ll input;
        cin>>input;
        a[input]++;
        sum+=input;
    }
   // cout<<sum<<endl;
    int q;
    cin>>q;
    for(int i=0; i<q; i++){
        int b, c;
        cin>> b >>c;

        sum-=a[b]*b;
        sum+=a[b]*c;
        if(c!=b){
            a[c]+=a[b];        
            a[b]=0;
        }

        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 9428
#include <iostream>
using namespace std;
int vis[200];
int main(int argc, char** argv) {
	int n,k;
	cin >> n >> k;
	swap(n,k);
	for(int i=1;i<=n;i++)
	{
		int m;
		cin >> m;
		for(int j=1;j<=m;j++)
		{
			int x;
			cin >> x;
			vis[x]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=k;i++) ans+=vis[i]==0;
	cout << ans;
	return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,t,res;
    cin>>n>>m;
    res=1;
    for(int i = 1;i*i<=(m+1);i++){
        if(m%i==0){
            if(m/i>=n){
                res = max(res,i);
            }
            if(i>=n){
                res = max(res,m/i);
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			Scanner scn = new Scanner(System.in);
			int N = scn.nextInt();
			int X = scn.nextInt();
			int T = scn.nextInt();

			int num = 0;


			while (N > 0) {
				num ++;
				N = N - X;
			}

			System.out.println(num * T);

		}
}

Measured memory_bytes: 35736
N = int(input())
s = input()
t = input()

ans = 2*N
for i in range(N) :
    flg = True
    for j in range(N-i) :
        if s[i+j] != t[j] :
            flg = False
    if flg == True :
        ans = N+i
        break

print(ans)


Measured memory_bytes: 2940
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

for i in range(n-k):
  if t[i] == t[i+k]:
    t[i+k] = 0

print(sum([t.count("r")*p, t.count("s")*r, t.count("p")*s]))


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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 1e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

bool used[N];
vi g[N];
int kol = 0;

void dfs (int v, int p) {
    used[v] = 1;
    for (auto to : g[v]) {
        if (to == p) continue;
        kol++;
        if (!used[to]) dfs(to, v);
    }
}


signed main() {
    #ifdef Flash
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, m, A, B;
    cin >> n >> m >> A >> B;
    string s, s1;
    for (int i = 0; i < m; i++) {
        if (i + 1 <= A) s+= "0";
        else s+= "1";
    }
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') s1+= "0";
        else s1+= "1";
    }
    for (int i = 0; i < n; i++) {
        if (i + 1 <= B) cout << s << "\n";
        else cout << s1 << "\n";
    }
}


Measured memory_bytes: 24704
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m  = sc.nextInt();
        int d = sc.nextInt();

        if (d == 0) {
            System.out.println((double) (m- 1) / (double) n);
        } else {
            System.out.println((double) 2 * (n - d) * (m - 1)/ (double) Math.pow(n, 2));
        }


        System.out.println();
    }

}

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

// utility of stdin,stdout
#define BUFS cout <<
#define BUFE << endl 

int main(int argc, char const *argv[]){
	int r,d;
	std::vector<int> x(13);
	cin >> r >> d >> x.at(0);
	for (int i = 1; i <= 10; ++i)
	{
		x.at(i) = r * x.at(i - 1) - d;
		BUFS x.at(i) BUFE;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

char buf[100002];
int ans[100001], ptr;

int main (void) {
	int n, m, i, j;
	
	scanf("%d %d\n", &n, &m);
	gets(buf);
	
	for (i = n; i > 0;) {
		for (j = i < m ? i : m; j >= 1; j--) {
			if (buf[i - j] == '0') break;
		}
		if (!j) break;
		ans[ptr++] = j;
		i -= j;
	}
	
	if (i) puts("-1");
	else while (ptr--) printf("%d ", ans[ptr]);
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n != 0) calc(n);
			else break;
		}
	}
	public void calc(int n){
		int count = 0;
		for(int i = 1; i < n; i++){
			int sum = 0;
			for(int j = i; j < n; j++){
				sum = sum + j;
				if(sum == n) count++;
				else if(sum > n) break;
			}
		}
		System.out.println(count);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 19928
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {

int n ;
cin >> n ;
int a[n] ;
int cnt[100001] ;
for(int i=0;i<100001;i++) cnt[i] = 0  ; 

for(int i=0;i<n;i++)
{
    cin >> a[i] ;
    if(a[i]!=0) cnt[a[i]-1]++ ;
    cnt[a[i]+1]++ ;
    cnt[a[i]]++ ;
}

int MAX =  -1 ;
for(int i=1;i<100001;i++)
{
    if(cnt[i]>MAX) MAX = cnt[i] ;
}

cout << MAX << endl ;

return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main(){
  string in;
  int num, h;
  int len;
  string sub;

  while (true){
    cin >> in;

    if (in == "-"){
      break;
    }

    len = in.length();

    cin >> num;

    for (int i = 0; i < num; i++){
      cin >> h;
      sub = in.substr(0, h);
      in = in.substr(h, len) + sub;
    }

    cout << in << endl;
  }


  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll h,w,n;cin>>h>>w>>n;
    ll m=max(h,w);
    ans=(n+m-1)/m;
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;

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

    ll n,a,b;
    cin >> n >> a >> b;
    vector<int> h(n);
    for(int i=0; i<n; i++)
        cin >> h[i];
    sort(all(h));
    ll hi=h[n-1]/b + 1,lo=0,mid;
    
    while(hi>lo){
        mid=(hi+lo+1)/2;
        ll br=0;
        for(int i=0; i<n; i++){
            ll c = h[i]-mid*b;
            if(c>0){
                br+=c/(a-b);
                if(c%(a-b)>0)
                    br++;
            }
        }
        if(br>mid)
            lo=mid;
        else
            hi=mid-1;
        
    }
    cout << lo+1;
}

Measured memory_bytes: 640