akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int f[1010][1010];

int a[1010][1001];

int main(){
	int n=read(),m=read(),q=read();
	for(int i=1;i<=m;i++){
		int x=read(),y=read();
		a[x][y]++;
	}
	for(int i=1;i<=500;i++){
		for(int j=i;j<=500;j++){
			f[i][j]=f[i][j-1]+a[i][j];
		}
	}
	for(int i=1;i<=500;i++){
		for(int j=i;j>=1;j--){
			f[j][i]+=f[j+1][i];
		}
	}
	
	for(int i=1;i<=q;i++){
		int x=read(),y=read();
		cout<<f[x][y]<<endl;
	}
	return 0;
}


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

int main(){
  int S;
  cin>>S;
  if(0<S/100 && S/100<=12)
    if(0<S%100 && S%100<=12)
      cout<<"AMBIGUOUS"<<endl;
    else
      cout<<"MMYY"<<endl;
  else
    if(0<S%100 && S%100<=12)
      cout<<"YYMM"<<endl;
    else
      cout<<"NA"<<endl;
}

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

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline LL read(){
	LL x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const LL MAXN = 500010;
const LL INF = 1e18;

LL N,X;
LL ans=INF,ret=0;
LL s[MAXN+1],a[MAXN+1];

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(),X=read();
	for(LL i=1;i<=N;i++) a[i]=read(),s[i]=s[i-1]+a[i];
	for(LL i=1;i<=N;i++){
		LL now=0; ret=0;
		for(LL j=N;j>=1;j-=i){
			LL r=j,l=max(j-i+1,1LL); ++now;
			ret+=(s[r]-s[l-1])*(2*now+1); 
			if(ret>ans) {ret=ans; break;}
			if(now==1) {
				ret+=(s[r]-s[l-1])*2;
				if(ret>ans) {ret=ans; break;}
				ret+=(r-l+1)*X;
			}
			if(ret>ans) {ret=ans; break;}
		} ans=min(ans,ret);
	} printf("%lld\n",ans+N*X);
	return 0;
}




Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << (X - Z) / (Y + Z) << endl;
}


Measured memory_bytes: 256
// abc132_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> PP;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

struct Item {
    int cost, v, cnt;
    Item(int cost, int v, int cnt): cost(cost), v(v), cnt(cnt){}
    bool operator>( const Item& other ) const { return cost > other.cost; }
};

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);

    REP(i, M){
        int u, v;
        cin >> u >> v; u--; v--;
        G[u].emplace_back(v);
    }

    int S, T;
    cin >> S >> T; S--, T--;

    vector<vector<int>> dist;
    dist.assign(N, vector<int>(3, INF));
    dist[S][0] = 0;

    priority_queue<Item, vector<Item>, greater<Item>> pq;
    pq.push(Item(0, S, 0));
    while (!pq.empty()){
        Item itm = pq.top(); pq.pop();

        if (itm.v == T && itm.cnt == 0){
            print(itm.cost / 3);
            return 0;
        }

        for (auto n: G[itm.v]){
            int ncost = itm.cost + 1;
            int ncnt = (itm.cnt + 1) % 3;
            if (ncost < dist[n][ncnt]){
                dist[n][ncnt] = ncost;
                pq.push(Item(ncost, n, ncnt));
            }
        }
    }

    print(-1);

    return 0;
}


Measured memory_bytes: 11264
import java.util.Scanner;

public class Main
{
    int a, b, c, d;
    int ans = 0;
    
    public static void main(String args[])
    {
	new Main().run();
    }
    
    void run()
    {
	in();

	a = Math.max(a, c);
	b = Math.min(b, d);
	ans = b - a;
	
	out();
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);

	a = sc.nextInt();
	b = sc.nextInt();
	c = sc.nextInt();
	d = sc.nextInt();
    }

    void out()
    {
	System.out.println(ans < 0 ? 0 : ans);
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int n;
int d[100005],cc[100005];
vector<pair<int,int> > glaph[100005];
void dfs(int x,int prev)
{
	for(int i=0;i<glaph[x].size();i++)
	{
		int y=glaph[x][i].first;
		int z=glaph[x][i].second;
		if(y==prev)
			continue;
		d[y]=d[x]+z;
		cc[y]=d[y]%2;
		dfs(y,x);
	}
}
int main()
{
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		a--;
		b--;
		c=c%2;
		glaph[a].push_back(make_pair(b,c));
		glaph[b].push_back(make_pair(a,c));
	}
	dfs(0,-1);
	for(int i=0;i<n;i++)
		cout<<cc[i]<<endl;
	return 0;
}

Measured memory_bytes: 9472
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int h, w;
    string ans = "Possible";
    cin >> h >> w;
    vector<string> a(h);
    for (int i=0; i<h; ++i){
        cin >> a[i];
    }
    int nh, nw;
    nh = 0;
    nw = 0;
    while(!(nh == h-1 && nw == w-1)){
        a[nh][nw] = '.';
        if(nh + 1 < h && a[nh + 1][nw] == '#'){
            nh++;
            continue;
        }
        else if(nw + 1 < w && a[nh][nw + 1] == '#'){
            nw++;
            continue;
        }
        else {
            break;
        }
    }
    a[nh][nw] = '.';
    for (int i=0; i<h; ++i){
        for (int j=0; j<w; ++j){
            if(a[i][j] == '#'){
                ans = "Impossible";
                break;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

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

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, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int x = 0, y = 0, score = 0;
    rep(i, n-1) if (s[i] == s[i+1]) ++score;
    rep(i, n-1) if (s[i]=='R' && s[i+1]=='L') ++x;
    if ((s[0]=='L') == (s[n-1]=='R')) {
        ++y;
        if (s[0] != 'L') --x;
    }
    score += min(x, k) * 2;
    k -= x;
    if (k > 0) score += y;
    cout << score << endl;
    return 0;
}


Measured memory_bytes: 3736
#include<iostream>

using namespace std;


int main() {
	int n;

	cin >> n;

	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0)
			cout << " " << i;
		else {
			int x = i;
			while (x != 0) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}

	cout << endl;

	return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  cout << s.substr(0, 3) << '\n';
}


Measured memory_bytes: 3640
//make sure to make new file!
import java.io.*;
import java.util.*;

public class Main{
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      StringTokenizer st = new StringTokenizer(f.readLine());
      
      int a = Integer.parseInt(st.nextToken());
      int b = Integer.parseInt(st.nextToken());
      int c = Integer.parseInt(st.nextToken());
      int d = Integer.parseInt(st.nextToken());
      
      int at = c/b;
      if(c%b != 0) at++;
      int bt = a/d;
      if(a%d != 0) bt++;
      
      if(at <= bt){
         out.println("Yes");
      } else {
         out.println("No");
      }
      
      
      
      
      
      
      
      
      
      out.close();
   }
   
      
}

Measured memory_bytes: 32644
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	switch {
	case a == b:
		fmt.Println(c)
	case b == c:
		fmt.Println(a)
	case c == a:
		fmt.Println(b)
	}
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))

x1 = 0
for n in range(N):
    x1 += A[n] * (1 if n % 2 == 0 else - 1)
x1 //= 2
print(x1 * 2, end="")

lastx = x1
for a in A[:-1]:
    lastx = a - lastx
    print(" " + str(lastx * 2), end="")


Measured memory_bytes: 14092
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N; cin >> N;
    int A[200200];
    rep(i, N) cin >> A[i];
    int l[200200], r[200200];
    l[0] = 0, r[N + 1] = 0;
    rep1(i, N) {
        l[i] = max(l[i - 1], A[i - 1]);
    }
    per1(i, N) {
        r[i] = max(r[i + 1], A[i - 1]);
    }
    rep(i, N) {
        int ans = max(l[i], r[i + 2]);
        cout << ans << endl;
    }
	return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,w[105],t,v[105],x,dp[105][105][305],h[105],ans;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> t >> w[1] >> v[1]; x=w[1];
    for(int i=2;i<=n;i++){
        cin >> w[i] >> v[i];
        w[i]-=x;
    }
    w[1]=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=300;j++){
            for(int k=0;k<=n;k++) dp[i][k][j]=-LINF;
        }
    }
    for(int i=0;i<=n;i++) dp[i][0][0]=0;

    for(int i=1;i<=n;i++){
        for(long long j=0;j<=300;j++){
            for(int k=1;k<=n;k++){
                if(j>=w[i]) dp[i][k][j]=dp[i-1][k-1][j-w[i]]+v[i];
                dp[i][k][j]=max(dp[i][k][j],dp[i-1][k][j]);
                if(k*x+j<=t) ans=max(ans,dp[i][k][j]);
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 25472
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>

typedef long long ll;

int main() {
    ll n, c;
    std::cin >> n >> c;

    std::vector<ll> dist(n);
    std::vector<ll> revdist(n);
    std::vector<ll> nutr(n);

    ll allnutr = 0;

    for (int i = 0; i < n; ++i) {
        ll x, y;
        std::cin >> x >> y;
        dist[i] = x;
        revdist[i] = c - x;
        nutr[i] = y;
        allnutr += y;
    }

    ll maxall = allnutr - c + std::max(dist[0], c - dist[n - 1]);

    std::vector<ll> nutr_clockwise(n);
    std::vector<ll> nutr_cntrclockwise(n);
    ll wise_cnt = 0, cntrwise_cnt = 0;
    for (int i = 0; i < n; ++i) {
        wise_cnt += nutr[i];
        nutr_clockwise[i] = wise_cnt - dist[i];
        cntrwise_cnt += nutr[n - i - 1];
        nutr_cntrclockwise[n - i - 1] = cntrwise_cnt - (c - dist[n - i - 1]);
    }

    std::vector<ll> prefclockwise(n), prefcntrclockwise(n);
    ll totalclockwise = 0, totalcntrclockwise = 0;
    prefclockwise[0] = std::max(0LL, (nutr[0] - dist[0]));
    prefcntrclockwise[n - 1] = std::max(0LL, (nutr[n - 1] - (c - dist[n - 1])));
    for (int i = 1; i < n; ++i) {
        prefclockwise[i] = std::max(nutr_clockwise[i], prefclockwise[i - 1]);
        prefcntrclockwise[n - i - 1] =
            std::max(nutr_cntrclockwise[n - i - 1], prefcntrclockwise[n - i]);
    }

    long long max = maxall;
/*
    for (int i = 0; i < n; ++i) {
 //       std::cout << prefclockwise[i] << "\n";
   //     std::cout << prefcntrclockwise[i] << "\n";
     //   std::cout << prefclockwise[i] + prefcntrclockwise[i] << "\n";
        long long new_max = std::max(std::max(prefclockwise[i] + prefcntrclockwise[i] - dist[i],
                                        prefcntrclockwise[i] + prefclockwise[i] - nutr[i] - (c - dist[i])),
                                    std::max(prefclockwise[i],
                                    prefcntrclockwise[i]));
        max = std::max(max, new_max);
    }
  */
    for (int i = 0; i < n - 1; ++i) {
        long long new_max = std::max(prefclockwise[i], prefclockwise[i] - dist[i] + prefcntrclockwise[i + 1]);
        max = std::max(max, new_max);
    }
    max = std::max(max, prefclockwise[n - 1]);
    max = std::max(max, prefcntrclockwise[0]);
    for (int i = 1; i < n; ++i) {
        long long new_max = std::max(prefcntrclockwise[i],
                                        prefcntrclockwise[i] - (c - dist[i]) + prefclockwise[i - 1]);
        max = std::max(max, new_max);
    }

    std::cout << max;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n,m;
ll s[e3],t[e3];
ll dp[e3][e3];
ll vis[e3][e3];

ll solve(ll i,ll j){
  if(i == n || j == m) return 0;
  if(vis[i][j]) return dp[i][j];
  vis[i][j] = 1;
  if(s[i] == t[j]){
    dp[i][j] += 1 + solve(i+1,j+1);
  }
  dp[i][j] -= solve(i+1,j+1);
  dp[i][j] += mod;
  dp[i][j] += solve(i+1,j);
  dp[i][j] += solve(i,j+1);
  dp[i][j] %= mod;
  return dp[i][j];


}


int main(){
  cin >> n >> m;
  for(ll i = 0;i < n;i++) cin >> s[i];
  for(ll i = 0;i < m;i++) cin >> t[i];
  // for(ll i = 0;i <= n;i++) dp[i][0] = 1;
  // for(ll i = 0;i <= m;i++) dp[0][i] = 1;
  // solve(0,0);
  // for(ll i = 0;i <= n;i++){
  //   for(ll j = 0;j <= m;j++) cerr << dp[i][j] << " ";
  //   cerr << endl;
  // }
  cout << (solve(0,0)+1)%mod << endl;

}


Measured memory_bytes: 257024
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
from itertools import accumulate
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N = int(sys.stdin.readline())
L = [int(sys.stdin.readline().rstrip()) for _ in range(N)]

print(reduce(lcm, L))

Measured memory_bytes: 66028
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int x;
	cin >> x;
	if (x < 1200) puts("ABC");
	else puts("ARC");
	return 0;
}

Measured memory_bytes: 256
using System;


namespace atCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int count = int.Parse(s[0]);
            int max = int.Parse(s[1]);
            int time = int.Parse(s[2]);

            int result = ((count / max) + ((count % max == 0) ? 0 : 1)) * time;


            Console.WriteLine(result.ToString());
        }
    }
}

Measured memory_bytes: 27276
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)
#define vec_all(vec) vec.begin(), vec.end()

// vectorデバッグ
template<typename T>
void dump_vec(vector<T> vec) {
    rep(i, vec.size()) {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main() {
    vector<char> all_char;
    rep(i, 26) {
        all_char.push_back('a' + i);
    }

    int n;
    cin >> n;
    vector<string> s(n);

    rep(i, n) {
        cin >> s[i];
    }

    vector<int> char_counts(26, -1);

    int tmp_count;
    rep(i, n) {
        rep(j, all_char.size()) {
            tmp_count = count(s[i].cbegin(), s[i].cend(), all_char[j]);
            if (char_counts[j] == -1) {
                char_counts[j] = tmp_count;
            } else {
                char_counts[j] = min(tmp_count, char_counts[j]);
            }
        }
    }

    rep(i, char_counts.size()) {
        rep(j, char_counts[i]) {
            cout << (char) ('a' + i);
        }
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,i;
    scanf("%d",&n);
    for(i=n;i<=10^9;i++)
    {
        if(i%2==0 && i%n==0)
        {
            printf("%d",i);
            break;
        }
    }
  return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  string s;
  int k;
  cin >> s >> k;

  REP(i, s.size()) {
    int x = (26 - (s[i] - 'a')) % 26;
    if (x <= k) {
      s[i] = 'a';
      k -= x;
    }
  }

  s[s.size() - 1] += k % 26;

  cout << s << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 900000000000000004
signed main(void){
    int n;cin>>n;
    int c=0,d=0;
    rep(i,n){
        int d0,c0;cin>>d0>>c0;
        c+=c0;
        d+=c0*d0;
    }
    cout<<c-1+(d-1)/9<<endl;
}
        


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

#define int long long

void fast_io() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int oo = 1e18;

int n, k, x[100001];
int posLeft[100001];
int posRight[100001];
int pre1[100001], pre2[100001];

signed main() {
	fast_io();
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>x[i];
	int nbP=0,nbM=0;
	for(int i=0;i<n;i++){
		if(x[i] < 0)posLeft[nbM++]=-x[i];
		else posRight[nbP++]=x[i];
	}
	sort(posLeft, posLeft+nbM);
	sort(posRight, posRight+nbP);
	int best = +oo;
	for(int i=0;i<=k;i++){
		int A=0, B=0;
		if(i <= nbM and k-i <= nbP) {
			if(i > 0) {
				A = 2LL * posLeft[i-1];
			}
			if(i < k)
				B = posRight[k-i-1];
			best = min(best, A+B);
		}
		A=0,B=0;
		if(i <= nbP and k-i <= nbM) {
			if(i > 0)
				A = 2LL*posRight[i-1];
			if(i<k)
				B=posLeft[k-i-1];
			best=min(best, A+B);
		}
	}
	cout<<best<<endl;
}


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

int main() {
	string S,T;
	cin >> S >> T;
	for(int i=S.size()-T.size(); i>=0; --i) {
		string tmp = S.substr(i, T.size());
		bool flag = false;
		for(int j=0; j<T.size(); ++j) {
			if(tmp[j] != T[j] && tmp[j] != '?') {
				flag = true;
				break;
			}
		}
		if(flag) continue;
		else {
			for(int j=0; j<i; ++j) {
				if(S[j] == '?') cout << 'a';
				else cout << S[j];
			}
			cout << T;
			for(int j=i+T.size(); j<S.size(); ++j) {
				if(S[j] == '?') cout << 'a';
				else cout << S[j];
			}
			cout << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main()
{
  int n;
  cin >> n;
  int a[n][n];
  int dp[n][n];
  int rdp[n][n],cdp[n][n];
  int mex = -100000000;
  rep(i,n)rep(j,n)
    {
      cin >> a[i][j];
      rdp[i][j] = cdp[i][j] = -100000000;
      mex = max(mex,a[i][j]);
    }
  if(n == 1)
    {
      cout << a[0][0] << endl;
      return 0;
    }
  /*
  rep(i,n)
    {
      rdp[i][0] = a[i][0];
      REP(j,1,n)
	{
	  rdp[i][j] = max(rdp[i][j],rdp[i][j-1]+a[i][j]);
	  mex = max(mex,rdp[i][j]); 
	}
    }

  rep(x,n)
    {
      cdp[0][x] = a[0][x];
      REP(y,1,n)
	{
	  cdp[y][x] = max(cdp[y][x],cdp[y-1][x]+a[y][x]);
	  mex = max(mex,cdp[y][x]);
	}
    }
*/
  rep(i,n)
    {
      dp[i][0] = a[i][0];
      REP(j,1,n)
	{
	  dp[i][j] = dp[i][j-1] + a[i][j];
	  mex = max(mex,dp[i][j]);
	}
    }

  REP(i,1,n)rep(j,n)dp[i][j] = dp[i][j] + dp[i-1][j],mex = max(mex,dp[i][j]);



  //REP(i,1,n)
  for(int i=n-1;i>=0;i--)
    {
      //REP(j,1,n)
      for(int j=n-1;j>=0;j--)	
	{
	  for(int y=i;y>=0;y--)
	    {
	      for(int x=j;x>=0;x--)
		{
		  int a,b,c;
		  a = x-1>=0?dp[i][x-1]:0;
		  b = y-1>=0?dp[y-1][j]:0;
		  c = (x-1>=0 && y-1>=0)?dp[y-1][x-1]:0;
		  int area = dp[i][j] - (a+b) + c;
		  mex = max(area,mex);		  
		}
	    }
	}
    }


  cout << mex << endl;  
  return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const double EPS = 1e-10;

main(){
  int L;
  int data[12];
  while(cin >> L){
    int size;
    for(size=0;;size++){
      char c;
      scanf("%d%c", &data[size], &c);
      if(c == '\n'){
	size++;
	break;
      }
    }
    double len[12][12];
    for(int i=0;i<size;i++){
      for(int j=0;j<size;j++){
	int a = abs(data[i] - data[j]);
	int b = data[i] + data[j];
	len[i][j] = sqrt((double)(b*b) - (double)(a*a));
      }
    }
    /*for(int i=0;i<size;i++){
      for(int j=0;j<size;j++){
	cout << len[i][j] << ' ';
      }
      cout << endl;
      }*/
    double dp[1<<12][12];
    fill(dp[0], dp[1<<12], 100000.0);
    for(int i=0;i<size;i++){
      dp[1<<i][i] = (double)(data[i]*2);
    }
    for(int i=0;i<(1<<size);i++){
      for(int j=0;j<size;j++){
	if(dp[i][j]<0.0 || dp[i][j]-EPS > L) continue;
	for(int k=0;k<size;k++){
	  if(i & 1<<k) continue;
	  dp[i | 1<<k][k] = min(dp[i | 1<<k][k], dp[i][j] - (double)data[j] + (double)len[j][k] + (double)data[k]);
	}
      }
    }
    /*for(int i=0;i<(1<<size);i++){
      for(int j=0;j<size;j++){
	cout << dp[i][j] << ' ' ;
      }
      cout << endl;
      }*/
    bool f = false;
    for(int i=0;i<size;i++){
      double tmp = dp[(1<<size)-1][i];
      if(tmp < 0.0) continue;
      if(tmp < L || abs(tmp - L) < EPS){
	f = true;
	//cout << tmp << endl;
	break;
      }
    }
    if(f) cout << "OK" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 1284
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;

int main(int argc, char **argv) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf((a == b && b == c) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define y1 xoxo
using namespace std;

const int N=1e3+20,MAX=1e7;

int n,m,x1,y1,x2,y2,dp[N][N];
char a[N][N];
deque <pair <int,int>> dq;
int dx[]={+1,-1, 0, 0};
int dy[]={ 0, 0,+1,-1};
bool vis[N][N];

bool invalid(int x,int y)
{
	return min(x,y)<0 or x>=n or y>=m or a[x][y]=='#' or vis[x][y];
}

void add(int x,int y,int d,int dir)
{
	dp[x][y]=d;
	if(dir==1) dq.push_back({x,y});
	else dq.push_front({x,y});
}

int main()
{
	scanf("%d%d%d%d%d%d",&n,&m,&x1,&y1,&x2,&y2);
	for(int i=0;i<n;i++) scanf(" %s",a[i]);

	x1--,y1--,x2--,y2--;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			dp[i][j]=MAX;

	add(x1,y1,0,0);
	while(not dq.empty())
	{
		auto p=dq.front();
		dq.pop_front();
		if(vis[p.first][p.second]) continue;
		vis[p.first][p.second]=true;

		for(int k=0;k<4;k++)
		{
			int x=p.first+dx[k],y=p.second+dy[k];
			if(invalid(x,y)) continue;
			add(x,y,dp[p.first][p.second],0);
		}

		for(int x=p.first-2;x<=p.first+2;x++)
		{
			for(int y=p.second-2;y<=p.second+2;y++)
			{
				if(invalid(x,y)) continue;
				if(dp[x][y]>dp[p.first][p.second]+1) add(x,y,dp[p.first][p.second]+1,1);
			}
		}
	}

	if(not vis[x2][y2]) printf("-1");
	else printf("%d",dp[x2][y2]);
}

Measured memory_bytes: 9836
#include<iostream>
using namespace std;
int main() {
    int H;
    int W;
    int i;
    int j;
    while (1) {
        cin >> H >> W;
        if (H==0) {
            if (W==0) break;
        }
        for (i=0;i<H;i++) {
            for (j=0;j<W;j++) {
                if ((i+j)%2==1) {
                    cout << ".";
                } else {
                    cout << "#";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
($%,@D)=<>;
$_=[split]for@D;
@s=(_,0,(-1e15)x--$%);
for(1..2*$%){
	for(@D){
		$s[$$_[1]]+=$-=$s[$$_[0]]+$$_[2]-$s[$$_[1]]
	}
	$_-$%or$s=$s[-1]
}
print$s<$s[-1]?inf:$s


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

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

		String S = sc.next();
		String T = sc.next();

		if(T.contains(S)){

			if ( T.startsWith(S) && T.length() == S.length() + 1){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 35748
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
ll n,m,q;
ll a[50],b[50],c[50],d[50];
ll ans=0;
void dfs(vi s){
	if(s.size()>=n){
		ll val=0;
		for(ll i=0;i<q;i++){
			if(s[b[i]] - s[a[i]]==c[i]) val+=d[i];
		}
		ans=max(ans,val);
		return ;
	}
	for(ll i=s.back();i<=m;i++){
		vi tmp(s.begin(),s.end());
		tmp.pb(i);
		dfs(tmp);
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m>>q;
	for(ll i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;
		b[i]--;
	}
	vi s;
	s.pb(1);
	dfs(s);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>

 

using namespace std;

 

int main() 
{
    int i, x;
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if(x==0)
          break;
        cout << "Case" << " " <<  i  << ":" << " " << x << endl;
    }
}


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

class Program
{

    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var A = int.Parse(inputs[0]);
        var B = int.Parse(inputs[1]);
        var K = int.Parse(inputs[2]);

        var gcd = Gcd(A, B);
        var count = 0;
        var result = 0L;
        for(long i = gcd; i >= 1; i--)
        {
            if ((A % i) == 0 && (B % i) == 0) count++;
            if(count == K)
            {
                result = i;
                break;
            }
        }

        Console.WriteLine(result);

    }

    /**
     * ユークリッド互除法（最大公約数)
     * <see cref="https://qiita.com/gushwell/items/e9614b4ac2bea3fc6486"/>
     */
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}



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

int gcd1[100000];
int gcd2[100000];

int gcd(int a, int b)
{
    if (a < b) {
        swap(a, b);
    }

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

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

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

    gcd1[0] = a[0];
    for (int i = 1; i < n; i++) {
        gcd1[i] = gcd(gcd1[i - 1], a[i]);
    }

    gcd2[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        gcd2[i] = gcd(gcd2[i + 1], a[i]);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans = max(ans, gcd2[1]);
        } else if (i == n - 1) {
            ans = max(ans, gcd1[n - 2]);
        } else {
            ans = max(ans, gcd(gcd1[i - 1], gcd2[i + 1]));
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
import math
a, b, h, m = map(int, input().split())
th = (60 * h + m) * math.pi / 360
tm = m * math.pi / 30
dx = a * math.cos(th) - b * math.cos(tm)
dy = a * math.sin(th) - b * math.sin(tm)
print(math.sqrt(dx * dx + dy * dy))


Measured memory_bytes: 9552
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

const int N = 1e6+7;
int n,a[N];

int32_t main()
{
	fast;

	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int cnt = 0;
	for(int i=2;i<n;i++)
		if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1]))
			cnt++;
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 256
use strict;
use warnings;

sub main {
    chomp(my $N = <STDIN>);
    print solver($N);
}
main() unless caller;

sub solver {
    my ($N) = @_;
    if($N%2==0){
        return '0.5000000000';
    } else {
        my $x = $N - int($N/2);
        return sprintf("%.10f",$x/$N);
    }
}

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

using namespace std ;

int main ()
{
    int a , b ;
    bool found = false ;
    cin >> a >> b ;
    for ( int i = 1 ; i <= 10000 ; i++ )
    {
        if ( ( i * 8 ) / 100 == a && ( i * 10 ) / 100 == b ) // if 8% of the number i is A and 10% of it is B then it is the correct answer
        {
            cout << i ;
            found = true ; // once we found the answer we break out of the loop
            break ;
        }
    }
    if ( !found ) cout << -1 ; // if the "found" variable remained "false" this means there is no answer

	return 0;
}


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


int main() {
  long long N, K;
  cin >> N >> K;

  //long long minn, maxx;
  long long minn = 0, maxx = 0;
  long long kk;
  long long answer =0;
  // initialize i = K
  for (auto j = 0; j < K; ++j) {
      kk = N - j;
      minn += j;
      maxx += kk;
  }
  answer += maxx - minn + 1;
  // for i < K
  for (auto i = K; i < N+1; ++i) {
    kk = N - i;
    minn += i;
    maxx += kk;
    answer += maxx - minn + 1;
  }
  answer = answer % (1000000000 + 7);
  cout << answer << endl;
}

Measured memory_bytes: 3596
n = int(input())
    
def primes(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 [i for i in range(n + 1) if is_prime[i]]

x = primes(1500)
res= [2]

for i in x:
    if i % 5 ==4:
        res.append(i)
y =res[:n]
yyy = list(map(lambda x: str(x),y))
yy =" ".join(yyy)
print(yy)

Measured memory_bytes: 9272
#include <iostream>
#include <cstdlib>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <math.h>

using namespace std;

#define ll long long int
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecchar vector<char>
#define vecstr vector<string>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(ll s = a;s < b;s++)
#define forllde(s,a) for(ll s = a;s >= 0;s--)

#define Pi 3.1415926535897932384626

int main() {
	ll n,k,ans = 0;
	string s = "Yes";
	bool flag = false;

	cin >> n >> k;

	vecll p(n);

	forll(i, 0, n)
		cin >> p[i];

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

	forll(i, 0, k)
		ans += p[i];
	
	cout << ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#define llint long long
#define inf 1e18
#define mod 1000000007

using namespace std;

string s;
llint dp[100005][2];

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

  cin >> s;
  llint n = s.size();
  reverse(s.begin(), s.end());

  dp[n][0] = 1;
  for(int i = n; i > 0; i--){
    for(int j = 0; j < 2; j++){
      for(int k = 0; k < 2; k++){
        for(int l = 0; l < 2; l++){
          if(k+l == 2) continue;
          if(j == 0 && k+l == 1 && s[i-1] == '0') continue;
          llint nj = j;
          if(k+l == 0 && s[i-1] == '1') nj = 1;
          dp[i-1][nj] += dp[i][j], dp[i-1][nj] %= mod;
        }
      }
    }
  }
  cout << (dp[0][0]+dp[0][1]) % mod << endl;

  return 0;
}


Measured memory_bytes: 2000
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using P =pair<int,int>;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const ll mod=1000000007;

int main(){
    int x,y;
    cin>>x>>y;
    cout<<x+y/2<<endl;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main()
{
  long long ans;
  long long re = 0;
	long long p;
  cin>>p;
  for(int i = 1; i <=p ; i++ )
  {
    for ( int j = 1; j<=p ; j++ )
    {
      for ( int k = 1; k<=p; k++  )
      {
        int x;
        x = gcd(i, j);
        ans = gcd(x,k);
          re = re+ans;
         
      }
    }
  }
  cout<<re;
    
}
long long gcd( long long a , long long b )
{
  while( a==0 || b==0 )
  {
  	if(a>=b)
  	{
    	a = a%b;
  	}
    else
    b = b%a;
  }  
  if(a!=0)
    return a;
  else
    return b;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int count = n - 1;
		System.out.println(Math.max(0, n - 1 - m));
	}
}



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

#define IOS                                                                    \
    ios::sync_with_stdio(0);                                                   \
    cin.tie(0);                                                                \
    cout.tie(0);
#define endl "\n"
typedef long long ll;
const ll MOD = 1e9 + 7;

int main(void) {
    IOS;
    int x;
    for(int i = 0; i < 5; i++) {
        cin >> x;
        if(x != i + 1) {
            cout << i + 1;
            break;
        }
    }
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int n,a[20],b[20],dp[1<<18][51],cnt[1<<18],ans=INF;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<n;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<1<<n;i++)
		cnt[i]=cnt[i>>1]+(i&1);
	memset(dp,0x3f,sizeof(dp));
	dp[0][1]=0;
	for(int i=0;i<(1<<n)-1;i++)
	{
		for(int j=1;j<=50;j++)
		{
			if(dp[i][j]!=INF)
			{
				for(int k=0,w,c=cnt[i];k<n;k++)
				{
					w=(k&1)==(cnt[i]&1)?a[k]:b[k];
					if(i>>k&1)
						c--;
					if(!(i>>k&1)&&w>=j)
						dp[i|(1<<k)][w]=min(dp[i|(1<<k)][w],dp[i][j]+c);
				}
			}
		}
	}
	for(int i=1;i<=50;i++)
		ans=min(ans,dp[(1<<n)-1][i]);
	printf("%d\n",ans==INF?-1:ans);
	return 0;
}


Measured memory_bytes: 53632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1_1_a
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                string[] a = Console.ReadLine().Split(' ');
                int x = int.Parse(a[0]);
                int y = int.Parse(a[1]);

                if (x == 0 && y == 0) break;
                else if (x <= y) Console.WriteLine("{0} {1}", x,y);
                else Console.WriteLine("{0} {1}",y,x);
            }
        }
    }
}


Measured memory_bytes: 19956
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,k;
	cin >> n >> k;
	++n; n /= 2;
	cout << ((n<k)?"NO":"YES") << endl;
	return 0;
}


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

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        char S[] = fs.next().toCharArray();
        char T[] = fs.next().toCharArray();
        for (int i = 0; i < N; i++) {
          System.out.print(S[i]);
          System.out.print(T[i]);
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define mod 1000000007
#define mod1 998244353
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
struct a{
  string s;
  li x;
};

void longestpallindrome(string s)
{
  li i,j,k;
  li n=s.length();
  bool table[n][n];
  memset(table,0,sizeof(table));
  for(i=0;i<n;i++)
  table[i][i]=1;
  li maxlength=1;
  li start=0;
  for(i=0;i<n-1;i++)
  {
    if(s[i]==s[i+1])
    {
      table[i][i+1]=1;
      if(maxlength<2)
      {maxlength=2;
      start=i;
       }
    }
  }
  for(k=3;k<=n;k++)
  {
    for(i=0;i<n-k+1;i++)
    {
      li j=i+k-1;

      if(table[i+1][j-1]&&s[i]==s[j])
      {
        table[i][j]=1;
        if(k>maxlength)
        {
          maxlength=k;
          start=i;
        }
      }
    }
  }
  cout<<s.substr(start,maxlength);
}

int main()
{
fast_io
string s;
cin>>s;
li i;
li n=s.length();
for(i=0;i<n/2;i++)
{
  if(s[i]!=s[n-i-1])
  break;
}
if(i!=n/2)
cout<<"No";
else
{
  for(i=0;i<n/4;i++)
  {
    if(s[i]!=s[n/2-i-1])
    break;
  }
  if(i!=n/4)
  cout<<"No";
  else
  {
    for(i=n/2+1;i<n;i++)
    {
      if(s[i]!=s[n-i+n/2])
      break;
    }
    if(i!=n)
    cout<<"No";
    else
    cout<<"Yes";
  }
}
return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[0]*n
b=[0]*n
c=[[0,0] for _ in range(n)]

for i in range(n):
    a[i],b[i]=map(int,input().split())
    c[i][0]=a[i]
    c[i][1]=b[i]

d=sorted(c, key=lambda x:x[1])

t=0
ans='Yes'

for j in range(n):
    t=t+d[j][0]
    if t > d[j][1]:
        ans='No'
        break

print(ans)


Measured memory_bytes: 42776
#include <iostream>
#include <deque>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#define llint long long

using namespace std;

struct WeightedUnionFind{
	int size;
	vector<int> parent;
	vector<llint> weight;
	
	WeightedUnionFind(){}
	WeightedUnionFind(int size){
		this->size = size;
		parent.resize(size+1);
		weight.resize(size+1);
		init();
	}
	void init(){
		for(int i = 0; i <= size; i++) parent[i] = i, weight[i] = 0;
	}
	int root(int i){
		if(parent[i] == i) return i;
		int r = root(parent[i]);
		weight[i] = weight[parent[i]] + weight[i];
		return parent[i] = r;
	}
	bool same(int i, int j){
		return root(i) == root(j);
	}
	llint get(int i, int j){ //i->jの重みを返す（非連結なら0を返す）
		if(!same(i, j)) return 0;
		return weight[j]-weight[i];
	}
	bool unite(int i, int j, llint x){ //i->jの重みをxに設定する。矛盾があればfalseを返す。
		int root_i = root(i), root_j = root(j);
		if(root_i == root_j){
			return get(i, j) == x;
		}
		parent[root_i] = root_j;
		weight[root_i] = weight[j]-weight[i]-x;
		return true;
	}
};

llint n, m;
WeightedUnionFind wuf(100005);

int main(void)
{
	cin >> n >> m;
	llint l, r, d;
	for(int i = 1; i <= m; i++){
		cin >> l >> r >> d;
		if(!wuf.unite(l, r, d)){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	
	return 0;
}


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

int main() {
  int N, S, t;
   cin >> N;
  
  t = N;
  S = 0;
  for (int i = 0; t > 0; i++) {
    S += t % 10;
    t /= 10;
    }
  if (N % S == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char arr[100],ar[11],arrr[11];
	cin>>ar>>arr>>arrr;
	int l=strlen(arr),j=0;
	for(int i=0;i<l;i++)
	{
		if(arr[i]>='A'&&arr[i]<='Z')
		{
			ar[j]=arr[i];
			j++;
		}
	}
//	cout<<l<<endl;
	cout<<"A"<<arr[0]<<"C"<<endl;
	return 0;
}


Measured memory_bytes: 256
// --------------
// Tejas Pandey  |
// 22 - 08 - 20  |
// Atcoder BC 176|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  ll ans = 0;
  for(int i = 0;i < n;i++) cin >> a[i];
  int mx = 0;
  for(int i = 0;i < n;i++)
	if(a[i] > mx) mx = a[i];
	else ans += mx - a[i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4420