akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

int main(int argc, char* argv[])
{
    long a, b;
    scanf("%ld%ld", &a, &b);

    if(a>b) {
        printf("%ld\n", MAX(a,b)+MAX(a-1,b));
    }
    else {
        printf("%ld\n", MAX(a,b)+MAX(a,b-1));
    }

 
    return 0;
}


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

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main(){
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll ans=0;
    ll small=(b/c)+(b/d)-(b/lcm(c,d));
    ll big=(a-1)/c+(a-1)/d-((a-1)/lcm(c,d));
    
    ans=b-small-((a-1)-big);
    cout << ans;
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    int ans = 1 , tmpn = 1;
    char tmpc = s[0];
    REP(i,3){
        if(s[i+1]==tmpc) tmpn++;
        else {tmpn=1; tmpc=s[i+1];}
        chmax(ans,tmpn);
    }
    Yn(ans>=3);

    return 0;
}

Measured memory_bytes: 256
s=input()
t=input()
import sys
m=[-1]*26
mrev=[-1]*26
for i,j in enumerate(s):
    x=ord(j)-ord('a')
    y=ord(t[i])-ord('a')
    if m[x]==-1:
        m[x]=y
    elif m[x]!=y:
        print('No')
        sys.exit()
for i,j in enumerate(t):
    x=ord(j)-ord('a')
    y=ord(s[i])-ord('a')
    if mrev[x]==-1:
        mrev[x]=y
    elif mrev[x]!=y:
        print('No')
        sys.exit()
print('Yes')



Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;

const ll MAX = 200010;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

int main(){
    COMinit();
    
    ll n,a,b,c;
    cin>>n>>a>>b;
    
    ll r=1,R=1;
    rep(i,0,a){
        c=(n-i)%1000000007;
        r=(r*c)%1000000007;
    }
    rep(i,0,b){
        c=(n-i)%1000000007;
        R=(R*c)%1000000007;
    }
    ll AA=modpow(2,n,1000000007);
    ll ans=(AA-(1+(r*finv[a])%1000000007 + (R*finv[b]%1000000007)))%1000000007;
    if(ans<0)ans+=1000000007;
    cout<<ans<<endl;

}

Measured memory_bytes: 4992
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        // なんか入力用の関数作ったけどまだテストしてないので使う前に確かめて
        static void Main(){
            long[] nd = ILongs();
            Console.WriteLine((nd[0]-1)/(2*nd[1]+1)+1);
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

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

int N,K;
double prob(int i){
  int j=0;
  double prob=1/double(N);

  while(i*pow(2,j)<K){
    prob=prob/double(2);
    ++j;
  }

  return prob;
}


int main(){
  cin>>N>>K;
  double ans;
  for(int i=1;i<=N;++i){
    ans=ans+prob(i);
  }
  
  cout<<fixed<<setprecision(10);
  cout<<ans<<endl;
}

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

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

	int N, M;
	scanf("%d %d", &N, &M);

	vector<bool> e(N, true);
	int A, B;
	for (int i = 0; i < M; i++) {
		scanf("%d %d", &A, &B);
		e[A - 1] = !e[A - 1];
		e[B - 1] = !e[B - 1];
	}
	for (int i = 0; i < N; i++) {
		if (!e[i]) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

namespace ForAtcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long n = inputLongArray[0];
            long d = inputLongArray[1];
            var count = 0;
            for (var i = 1; i <= n; i++)
            {
                long[] input = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
                if (Math.Sqrt(Math.Pow(input[0], 2) + Math.Pow(input[1], 2)) <= d) count++;
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 46928
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	int n,x;cin>>n>>x;
	vector<int> a;
	int d;
	for(int i=0;i<n;i++)
	{
		cin>>d;
		a.push_back(abs(x-d));
	}
	int g=a[0];
	for(int i:a)g=__gcd(g,i);
	cout<<g<<"\n";
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

struct UFTree {
    static const int MAX_N = 1e6;
    int p[MAX_N], r[MAX_N];

    UFTree(int n) : p(), r() {
        for(int i = 0; i < n; ++i) {
            p[i] = i;
            r[i] = 0;
        }
    }

    int root(int x) {
        return p[x] == x ? x : (p[x] = root(p[x]));
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;

        if(r[x] < r[y]) {
            p[x] = y;
        } else {
            p[y] = x;
            if(r[x] == r[y]) r[x]++;
        }
    }
};

int n, m;
string s;

int main() {
    cin >> n;
    V<P<Pii, int>> v(n), v2(n);
    REP(i, n) {
        int x, y;
        cin >> x >> y;
        v[i] = {{x, y}, i};
        v2[i] = {{y, x}, i};
    }

    sort(ALL(v));
    sort(ALL(v2));

    V<P<int, Pii>> edges;
    REP(i, n-1) {
        int x1 = v[i].first.first, y1 = v[i].first.second, node1 = v[i].second;
        int x2 = v[i+1].first.first, y2 = v[i+1].first.second, node2 = v[i+1].second;
        if (abs(x1-x2) <= abs(y1-y2)) {
            edges.push_back({abs(x1-x2), {node1, node2}});
        }
        y1 = v2[i].first.first, x1 = v2[i].first.second, node1 = v2[i].second;
        y2 = v2[i+1].first.first, x2 = v2[i+1].first.second, node2 = v2[i+1].second;
        if (abs(y1-y2) < abs(x1-x2)) {
            edges.push_back({abs(y1-y2), {node1, node2}});
        }
    }

    sort(ALL(edges));
    UFTree t = UFTree(n);

    ll res = 0;
    FOR(i, edges) {
        int cost = i->first, node1 = i->second.first, node2 = i->second.second;
        if (t.same(node1, node2)) continue;
        t.unite(node1, node2);
        res += cost;
    }

    std::cout << res << '\n';

    return 0;
}


Measured memory_bytes: 13424
#include <cstdio>
#include <iostream>
using namespace std;
const int MAXN = 1e5+5;
const int mod = 1e9+7;
int n, m;
int dp[MAXN];
bool broken[MAXN];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		int place;
		scanf("%d", &place);
		broken[place]=true; 
	}
	dp[0] = dp[1] = 1;
	for (int i = 2; i <= n; ++i) {
		if (broken[i]) continue;
		if (broken[i-1] == false) dp[i] += dp[i-1];
		if (broken[i-2] == false) dp[i] += dp[i-2];
		while (dp[i] > mod) dp[i] -= mod;
	}
	printf("%d", dp[n]);
	return 0;
}

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

#define forn(i,n) for(ll i = 0;i<n;i++)
#define forne(i,j,n) for(ll i = j;i<n;i++)
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ll INF = 1000000001;
const ll N = 100001;
const lld PI = 3.141593;
#define F first
#define pb(a) push_back(a)
#define S second
#define pii pair<int,int>
typedef pair<ll,ll> pll;

lld powm(ll base,ll exp) {
	ll ans=1;
	while(exp){
		if(exp&1) ans=(ans*base)%mod;
		exp>>=1,base=(base*base)%mod;
	}
	return ans;
}

// ll dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
// bool valid(ll i, ll j) {
// 	return i >= 1 && i <= n && j >= 1 && j <= m; 
// }
// int maxdepth = INT_MAX;
// vector<int> edgeVector[100000];
// ll minans = 1;
// printf("1 %d D\n",abs(r));
// priority_queue<ll,vector<ll>,greater<ll>> pq;
// ll a[N],b[N];
// vector<vector<ll>> adj(N);
// vector<set<ll>> adjs(N);
// ll adj[1001][1001];
// vector<vector<ll>> ans(1001);
// bool visited[N];
// ll cnt[1001];
// ll h,c,t;
// vector<pair<int, pair<int, int> > > g[300043];


int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

string s,t;
cin>>s>>t;
ll n = (ll)s.size();
ll fa = 0;
forn(i,n) {
	if(s[i] != t[i]) fa++;
}
cout<<fa<<endl;

}

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

class B {
	int d, n;
public:
	void solve()
	{
		ostringstream oss;
		if (n == 100)
			oss << (n + 1);
		else
			oss << n;
		for (int i{ 0 }; i < d; i++)
			oss << "00";

		cout << oss.str() << endl;
	}

	B() { cin >> d >> n; }
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair< ll,pair<ll , ll> >; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////

// c++17での名前衝突を避けるためdefine
#define gcd nyagcd
#define lcm nyalcm
ll nyagcd(ll x, ll y){
  ll z;
  if(x > y) swap(x,y);
  while(x){
    x = y % (z = x); y = z;
  }    
  return y;
}
ll nyalcm(ll x,ll y){
  return 1LL * x / gcd(x,y) * y;
}

void solve(){
  inl(A , B);
  out(lcm(A , B));



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,x,i,j,n,t,m,k,y;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    ll a1,a2,b1,b2 ;
    char ch ;
    cin>>n>>t ;
    cin>>str ;
    vll v ;
    for(i=0 ; i<n ; i=i+1)
    {
        if(str[i]=='A' && str[i+1]=='C')
        {
            v.pb(i+1) ;
            i++ ;
        }
    }
    while(t--)
    {
        cin>>a>>b ;
        vll::iterator it = lower_bound(all(v),a) ;
        vll::iterator itr = lower_bound(all(v),b) ;
		if(it==v.end())
		{
			cout<<"0\n" ;
			continue ;	
		} 
        if(*it>=b || it>=itr)
        {
            cout<<"0\n" ;
            continue ;
        }
        if(*itr==b)
        {
            cout<<itr-it<<"\n" ;
        }
        else
        {
            itr-- ;
            cout<<itr-it+1<<"\n" ;
        }
    }
}

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

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

int main() {
  int n;
  cin >> n;
  vector<double> v(n);
  rep(i, n) { cin >> v[i]; }

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

  double current = 0.0;
  rep(i, n-1) {
    if (i == 0) {
      current = (v[i] + v[i + 1]) / 2;
    } else {
      current = (current + v[i + 1]) / 2;
    }
  }
  cout << current;
}


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

typedef long long int LLI;

LLI a, b;

LLI extgcd(LLI a, LLI b, LLI &x, LLI &y) {
  LLI p;

  if (b == 0) {
    x = 1;
    y = 0;
    p = a;
  } else {
    p = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  }

  return p;
}

int main() {
  while (1) {
    if (scanf("%lld%lld", &a, &b) != 2) break;

    LLI x, y;
    LLI g = extgcd(a, b, x, y);
    printf("%lld %lld\n", g, a/g*b);
  }
}

Measured memory_bytes: 2612
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;

#define ll long long int



int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(u==s) a-=1;
    else b-=1;
    cout<<a<<" "<<b<<endl;
    
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a < b) swap(a, b);
    int gc = gcd(a, b);

    set<int> st;
    while (gc != 1) {
        bool flag = false;
        For(i, 2, (unsigned int)(sqrt(gc) + 1)) {
            if (i * i > gc) break;
            if (gc % i == 0) {
                st.insert(i);
                gc /= i;
                flag = true;
                break;
            }
        }
        if (not flag) break;
    }

    if (gc != 1) st.insert(gc);

    print(st.size() + 1);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    long n, k, ans = 1;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        if(i == 0) ans *= k;
        else ans *= k-1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n,max,a[7]={0,100,101,102,103,104,105},key=0;
	int dp[100001]={0},pre[100001];
	dp[100]=1;dp[101]=1;dp[102]=1;
	dp[104]=1;dp[105]=1;dp[103]=1;
	cin>>n;
	for(int i=100;i<=n;i++)
		for(int j=1;j<=6;j++)
			if(dp[i-a[j]]==1)	dp[i]=1;
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 640
use std::io::{BufRead, self, BufReader};

fn main() -> io::Result<()>{
    let mut stdin = BufReader::new(io::stdin());

    let mut buf = String::new();
    stdin.read_line(&mut buf)?;
    let nums = buf.split_ascii_whitespace().map(|a| a.parse::<u64>().unwrap()).collect::<Vec::<_>>();
    let (N,D) = (nums[0],nums[1]);

    let mut count = 0;

    for _ in 0..N{
	buf.clear();
	stdin.read_line(&mut buf)?;                                                                      
	let nums = buf.split_ascii_whitespace().map(|a| a.parse::<i128>().unwrap() as f64).collect::<Vec::<_>>();
	let dist = nums[0] * nums[0] + nums[1] * nums[1];
	count = if dist <= ((D * D) as f64) {count+1}else{count};
    }

    println!("{}",count);    

    Ok(())
}


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

int main()
{
    int N;
    cin >> N;
    bool count=false;
    vector<int> D1(N);
    vector<int> D2(N);
    for(int i=0; i<N; i++)
    {
        cin >> D1.at(i) >> D2.at(i);
    }
    for(int i=0; i<N-2; i++)
    {
        if((D1.at(i)==D2.at(i))&&(D1.at(i+1)==D2.at(i+1))&&(D1.at(i+2)==D2.at(i+2)))
        {
            count=true;
        }
    }

    if(count)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3628
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

class BST:
    __slots__ = ['root']
    def __init__(self):
        self.root = None
    def insert(self, key):
        x, y = self.root, None
        while x != None: x, y = x.left if key < x.key else x.right, x
        if y == None: self.root = Node(key)
        elif key < y.key: y.left = Node(key)
        else: y.right = Node(key)
    def print_tree(self):
        def inorder(node):
            return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
        def preorder(node):
            return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''
        print(inorder(self.root))
        print(preorder(self.root))

tree = BST()
input()
for e in sys.stdin:
    if e[0] == 'i': tree.insert(int(e[7:]))
    else: tree.print_tree()


Measured memory_bytes: 63248
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i =0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	int dp[n][3]={};
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(int i =1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<'\n';
}


Measured memory_bytes: 2560
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s, t;
    cin >> s >> t;
    
    int a, b;
    cin >> a >> b;
    
    string u;
    cin >> u;
    
    if (s == u) a--;
    else b--;
    
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace MF
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            while ((x = int.Parse(Console.ReadLine())) != 0)
            {
                var c = Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToList();
                var a = c.Sum() / x;
                Console.WriteLine("{0}", Math.Sqrt(c.Select(e => Math.Pow(e - a, 2)).Sum() / x));
            }
        }
    }
}

Measured memory_bytes: 10004
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub struct Graph {
  graph: Vec<Vec<usize>>,
  v: usize,
}

type Edge = (usize, usize);
impl Graph {
  pub fn new(edges: &[Edge], v: usize) -> Self {
    let mut graph = vec![Vec::new(); v];
    for &(u, v) in edges {
      graph[u].push(v);
      graph[v].push(u);
    }
    Self { graph, v }
  }

  pub fn new_directed(edges: &[Edge], v: usize) -> Self {
    let mut graph = vec![Vec::new(); v];
    for &(u, v) in edges {
      graph[u].push(v);
    }
    Self { graph, v }
  }

  pub fn add_directed_edge(&mut self, e: Edge) {
    self.graph[e.0].push(e.1);
  }

  pub fn add_edge(&mut self, e: Edge) {
    self.graph[e.0].push(e.1);
    self.graph[e.1].push(e.0);
  }

  pub fn shortest_path(&self, start: usize) -> Vec<Option<usize>> {
    let mut visited = std::collections::HashSet::new();
    let mut cost_list = vec![None; self.v];
    let mut que = std::collections::VecDeque::new();
    cost_list[start] = Some(0);
    visited.insert(start);
    que.push_back(start);
    while let Some(u) = que.pop_front() {
      for &v in &self.graph[u] {
        if visited.contains(&v) {
          continue;
        }
        visited.insert(v);
        let new_cost = cost_list[u].unwrap() + 1;
        cost_list[v] = Some(new_cost);
        que.push_back(v);
      }
    }
    cost_list
  }
}

fn main() {
  input! {
    n: usize, k: usize,
    av: [Usize1; n]
  };

  let mut edges = Vec::new();
  for i in 0..n {
    let u = i;
    let v = av[i];
    edges.push((u, v));
  }
  let graph = Graph::new_directed(&edges, n);
  let d = graph.shortest_path(0);
  let mut max = 0;
  let mut max_pos = 0;
  for i in 0..n {
    match d[i] {
      Some(x) if x > max => {
        max = x;
        max_pos = i;
      }
      _ => {}
    }
  }
  if k <= max {
    let res = d.iter().position(|&x| x == Some(k)).unwrap() + 1;
    println!("{}", res);
    std::process::exit(0);
  }

  let rest = k - (max + 1);
  let start = av[max_pos];
  let m = max - d[start].unwrap() + 1;
  let pos = rest % m + d[start].unwrap();
  let res = d.iter().position(|&x| x == Some(pos)).unwrap() + 1;
  println!("{}", res);
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int res = 0;
	if(a - b >= c)
		res = 0;
	else if(a - b < c)
		res = c - (a - b);


	cout << res;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define FOR(n) for(int i=0;i<n;i++)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]

int main()
{
	long long n;
	cin >> n;

	if (n == 0)cout << "0" << endl;
	else
	{
		n--;
		cout << (n * (n + 1)) / 2 << endl;
	}

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

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

int main(){

    ll N;
    cin >> N;
    V v(N);
    rep(i, N)cin >> v[i];
    sort(v.begin(), v.end(), greater<ll>());
    ll ans = 0, step = 0;
    if(N > 1)step = m_pow(2, N - 2);
    for(ll i = 0, j = m_pow(2, N - 1); i < N; i++, j = (j + step) % MOD){
        ans = (ans + (v[i] * j) % MOD) % MOD;
    }
    ans = (ans * m_pow(2, N)) % MOD;
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int n,m;
char c[25][25];
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};
int vis[23][23];
int mx=0;
void bfs(int x,int y){
	queue<pair<pair<int,int>,int> > q;
	q.push(make_pair(make_pair(x,y),0));
	while(!q.empty()){
		pair<pair<int,int>,int> p;
		p=q.front();
		q.pop();
		for(int i=0;i<4;i++){
			int ax=p.first.first+dx[i];
			int ay=p.first.second+dy[i];
			if(ax==x&&ay==y)continue;
			if(ax>=0&&ax<n&&ay>=0&&ay<m&&c[ax][ay]=='.'&&!vis[ax][ay]){
				vis[ax][ay]=p.second+1;
				mx=max(mx,vis[ax][ay]);
				q.push(make_pair(make_pair(ax,ay),vis[ax][ay]));
			}
		}
	}
}
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>c[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(c[i][j]=='#')continue;
			bfs(i,j);
			memset(vis,0,sizeof(vis));
		}
	}
	cout<<mx<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime


def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0: continue
        ex = 0

        while (n % i == 0):
            ex += 1
            n //= i
        res.append((i, ex))
    if n != 1: res.append((n, 1))
    return res

A,B = imn()

print(A//fractions.gcd(A,B)*B)

Measured memory_bytes: 5292
N,a,b = map(int,input().split())
S = str(input())

C=[]
A=0
B=0

for i in range(len(S)):
    if S[i] == 'a':
        if A+B < a+b:
            A += 1
            C.append('Yes')
        else:
            C.append('No')

    elif S[i] == 'b':
        if A+B < a+b and B < b:
            B += 1
            C.append('Yes')
        else:
            C.append('No')
    else:
        C.append('No')

for w in C:
    print(w)


Measured memory_bytes: 4784
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int [] answers = {1,2,3};
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        for(int i = 0; i<answers.length; i++){
            if(answers[i] != a && answers[i] != b){
                System.out.println(answers[i]);
            }
        }
    }
}


Measured memory_bytes: 22612
/*
        ঘরে থাকুন , সুস্থ থাকুন ।
    wan-_-s
*/
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define stay_home_stay_safe return 0
#define pb push_back
//const ll N = 200007 ;
void scan(ll &n) { scanf("%lld",&n) ; }
void scan(ll &n, ll &m) { scanf("%lld%lld",&n,&m) ; }
void scan(vector<ll> &v) { ll n = v.size() ; for(ll i=0 ;i<n;i++) scanf("%lld",&v[i]) ; }
//vector<ll> adj[N] ;


void sol () {
    ll n ,i ;
    cin >> n ;
    vector<ll> v(n) ;
    for ( i = 0 ; i <n ;i++) cin >> v[i] ;
    map<ll,ll> mp ;
    ll ans =1 ;
    for ( i = 1 ; i<= n ; i++) {
        ll x = (i + v[i%n]  )%n ;
        x+=n ;
        x%=n ;
        mp[x]++ ;
        if (mp[x]>1) ans = 0 ;
    }
    cout << (ans == 1 ? "YES\n" : "NO\n" ) ;

}


int main() {

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


    ll n , i ;

    cin >> n ;
    vector<ll>v(n),pos(n) ;
    for ( i= 0 ; i< n;i++) cin >> v[i] ;
    for ( i = 0 ; i< n ;i++) pos[v[i]-1]= i ;
    ll in = 1 , mx = 1  ;
    for ( i = 0 ; i< n-1 ;i++) {
        if ( pos[i]<pos[i+1] ) {
            in++ ;
        }
        else {
            mx = max(mx,in) ;
            in = 1 ;
        }
    }
    cout << n - max(mx,in) << endl ;

    stay_home_stay_safe ;
}






Measured memory_bytes: 3456
from math import gcd

k = int(input()) + 1
ans = 0

for s in range(1, k):
    for t in range(s, k):
        first = gcd(s, t)
        for u in range(t, k):
            if (v := len(set([s, t, u]))) == 1:
                ans += gcd(first, u)
            elif v == 2:
                ans += gcd(first, u) * 3
            else:
                ans += gcd(first, u) * 6
print(ans)



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

int main() {
  int n;
  cin >> n;
  
  int a = n/1000;
  int b = (n/100)%10;
  int c = (n/10)%10;
  int d = n % 10;
  
  if((a == b && a == c) || (b == c && c == d)){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}

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

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

    ll num = 0;
    for (ll i = max(A, B); ; i--) {
        if (A % i == 0 && B % i == 0) {
            if (++num == K) {
                cout << i << endl;
                return 0;
            }
        }
    }
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vi x(n);
    rep(i, n) cin >> x[i];
    ll ans = 0;
    rep(i, n-1) {
        ans += min((ll)(x[i+1]-x[i])*a, (ll)b);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3688
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let a: Vec<i32> = (0..n).map(|_| input()).collect();

    let sum: i32 = a.iter().sum::<i32>();
    let avg = sum / n as i32;

    let c1: i32 = a.iter().map(|a| (a - avg) * (a - avg)).sum();
    let c2: i32 = a.iter().map(|a| (a - avg - 1) * (a - avg - 1)).sum();
    println!("{}", std::cmp::min(c1, c2));
}


Measured memory_bytes: 4352
using namespace std; 
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define vect vector<ll>
#define maap map<ll,ll>  
#define MOD 998244353
#define mit map::iterator
#define pii pair<ll,ll>
#define rep(i,a,b)	for(ll i=a;i< b;i++)
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
typedef  long long   int  ll;
//stringstream convert; 
  //  convert << number; 
  //  string s = convert.str();
 ll fact[500005],invfact[500005]; 
 ll power(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = (z*x)%MOD;
		x = (x*x)%MOD;
		y /= 2;
	}
	return z;
}
 ll inv(ll x)
{
	return power(x,MOD-2);
}
ll divide(ll x, ll y)
{
	return (x*inv(y))%MOD;
}
ll C(ll n, ll k)
{
	if(k > n) return 0;
	return divide(fact[n], (fact[n - k]*fact[k])%MOD);
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
bool isPrime(int n) {
 
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
} 
void init(){
	ll p=MOD;
	fact[0]=1;
	ll i;
	for(i=1;i<500005;i++){
		fact[i]=(i*fact[i-1])%p;
	}
	i--;
	invfact[i]=power(fact[i],p-2);
	for(i--;i>=0;i--){
		invfact[i]=(invfact[i+1]*(i+1))%p;
	}
}
priority_queue < pair<ll,ll> , vector<pair<ll,ll> >,greater<pair<ll,ll> > > gq;
void ghost()
{   
  	ll i=0,j=0,k=0,l=0,n,r=-10000000000,t=0,q=0,x,y,m;
    cin>>n;
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
    	{
    		for(k=1;k<=n;k++)
    		{
    			l=l+__gcd(i,__gcd(j,k));
			}
		}
	}
	cout<<l<<endl;
}
signed main()
{int test=1;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
//cin>>test;
while(test--)
ghost();
return 0;
}

  

Measured memory_bytes: 3656
N,A,B,C,D = map(int,input().split())
S = input()
F = True
#飛び越えられるのは2マスまで
if ("##" in S[B-1:D]) or ("##" in S[A-1:C]):
  F  =False

#C > DのときAがBを飛び越える必要がある。
#... ->　.B. -> AB. -> .BA -> .B. :真ん中にBを退避させる
#飛び越えるためには...が必要，範囲はBが動ける範囲±1
if C > D and ("..." not in S[B-1-1:D+1]): 
    F = False
#print(S[B-1-1:D+2])

print("Yes" if F else "No")


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
const int N =1e5+100;
typedef long long ll;
int main()
{
    int n,m,t;
    while(cin>>n>>m)
    {
        int wa[N] ={0},sum1 =0,sum2 =0;
        bool ac[N] ={0};
        for(int i=0; i<m; i++)
        {
            string s;
            cin>>t>>s;
            if(ac[t])
                continue;
            if(s=="WA")
                wa[t]++;
            else if(s=="AC")
            {
                sum1++;
                sum2 +=wa[t];
                ac[t] =1;
            }
        }
        cout<<sum1<<" "<<sum2<<endl;
    }
    return 0;
}


Measured memory_bytes: 768
/*
 *  ॐॐॐॐ
 *  मनुष्य के साहस से बड़ा कोई लक्ष्य नहीं, हारा वही जो लड़ा नहीं ।। 
 *          ---- स्वामी विवेकानंद जी
 */
/*
 * Author: @SumitRaut
 */


#include <bits/stdc++.h>
#define debug1(x) cerr<<#x<<' '<<x<<'\n'
#define debug2(x,y) cerr<<#x<<' '<<x<<' '<<#y<<' '<<y<<'\n'
#define debug3(x,y,z) cerr<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<'\n'
#define sbc __builtin_popcount
#define pb push_back
#define em emplace
#define emb emplace_back
#define ll long long
int mod = 1e9+7;

template<typename T> void smax(T& a, T b) { if(a<b) a=b; }
template<typename T> void smin(T& a, T b) { if(a<b) a=b; }
template<typename T> T pw(T a,T b) { T p=1,one=1; while(b) { if(b&one) p=p*a; a=a*a; b >>=1; } return p; }
template<typename T> T gcd(T x,T y) { /* if(y==0) return x; return gcd (y,x%y); */ T t; while(y!=0) { t=y; y=x%y; x=t; } return x; }
template<typename T> T pwm(T a,T b) { T p=1,one=1,mod=1e9+7; while(b) { if(b&one) p=p*a%mod; a=a*a%mod; b >>=1; } return p; }

using namespace std;
class Timer { chrono::high_resolution_clock::time_point start_t, end_t; public: Timer() { start_t=chrono::high_resolution_clock::now(); } ~Timer() { end_t = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(end_t-start_t); cerr<<"\nRunTime: "<<duration.count()<<"ms"<<'\n'; } };

ll x,y,z;
inline void solve() {
    // Timer timer;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<' '<<y<<' '<<z<<'\n';

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // int t; cin>>t; while(t--)
        solve();
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=2e5+50;
const ll mod=1e9+7;
using namespace std;
ll f[nmax],invf[nmax],n,m,k,i,x,ans;
ll pw(ll n,ll p)
{
    ll tmp=n,ans=1;
    for(int i=0;i<=32;i++)
    {
        if(p&(1LL<<i))ans=(ans*tmp)%mod;
        tmp=(tmp*tmp)%mod;
    }
    return ans;
}
void pre1()
{
    f[0]=invf[0]=1;
    for(ll i=1;i<=2e5;i++)
    {
        f[i]=(f[i-1]*i)%mod;
        invf[i]=pw(f[i],mod-2);
    }
}
ll nck(int x,int y)
{
    if(y>x || y<0)return 0LL;
    if(!y)return 1LL;
    return (((f[x]*invf[y])%mod)*invf[x-y])%mod;
}
int main()
{
    //freopen("sol.in","r",stdin);
    //freopen("sol.out","w",stdout);
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    pre1();
	cin>>n>>m>>k;
	for(i=1;i<=n;i++)
	{
		x=i*(i-1)/2LL%mod*m%mod*m%mod*nck(n*m-2,k-2)%mod;
		ans=(ans+x)%mod;
	}
	for(i=1;i<=m;i++)
	{
		x=i*(i-1)/2LL%mod*n%mod*n%mod*nck(n*m-2,k-2)%mod;
		ans=(ans+x)%mod;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
import collections as cl
h,w,n = map(int,input().split())
l = []
for i in range(n):
  a,b = map(int,input().split())
  for i in range(3):
    x = a+(i-1)
    if x in [0,1,h,h+1]:
      continue
    for j in range(3):
      y = b+(j-1)
      if y in [0,1,w,w+1]:
        continue
      l.append((x-1)*w+y)
#print(l)
p = cl.Counter(l)
q = cl.Counter(p.values())
print((h-2)*(w-2)-sum(q.values()))
for i in range(1,10):
  if i in q.keys():
    print(q[i])
  else:print(0)

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll count =0;
    char c[3];
    rep(i,3){
        cin >> c[i];
        if(c[i] == '1')count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
    ll W,H,x,y,r;cin>>W>>H>>x>>y>>r;
    if(0<=x-r&&x+r<=W&&
    0<=y-r&&y+r<=H)cout<<"Yes";
    else cout <<"No";
    cout<<"\n";
  return 0;
}



Measured memory_bytes: 3092