akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <cstring>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;
ll M = 1000000007;
typedef pair<int, int> P;

typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
    return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
    return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
    return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
    return forall_a_in_P.second > forall_b_in_P.second;
}
ll GCD(ll x, ll y) {
	return x ? GCD(y % x, x) : y;
}

ll LCM(ll m, ll n)
{
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / GCD(m, n)) * n); // lcm = m * n / GCD(m,n)
}
void solve(){
    ll a,b;
    cin>>a>>b;
    ll ans=LCM(a,b);
    cout<<ans<<endl;
}


int main()
{
    solve();
}

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

int main() {
    int N, C;
    cin >> N >> C;
    using P = pair<int, pair<int, int>>; // 時刻, イベントタイプ, チャンネル
    priority_queue<P, vector<P>, greater<P>> que;
    rep(i, N) {
        int s, t, c;
        cin >> s >> t >> c;
        s *= 2, t *= 2, --c;
        que.push(P(s, {0, c}));
        que.push(P(t, {1, c}));
    }
    int ans = 0, now = 0;
    vector<int> channel(C);
    while(!que.empty()) {
        auto p = que.top();
        que.pop();
        int t = p.first;
        int type, c;
        tie(type, c) = p.second;
        if(type) { // 終了クエリ
            if(--channel[c] == 0) --now;
        } else { // 開始クエリ
            if(channel[c]++ == 0) ++now;
        }
        ans = max(ans, now);
    }
    cout << ans << '\n';
    return 0;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  set<int> a;
  rep(i,0,n+1){
    if(s[i]=='0'){
      a.insert(i);
    }
  }
  stack<int> q;
  bool p=true;
  int cur=n;
  while(cur!=0){
    int next=*a.lower_bound(cur-m);
    if(next==cur){
      p=false;
      break;
    }
    else{
      q.push(cur-next);
      cur=next;
    }
  }
  if(p){
    while(q.size()){
      cout<<q.top()<<endl;
      q.pop();
    }
  }
  else{
    cout<<-1<<endl;
  }
}

Measured memory_bytes: 5580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner stdIn = new Scanner(System.in);
		
		for (; ;) {
			int h = stdIn.nextInt();
			int w = stdIn.nextInt();
			
			if (h == 0 && w == 0) break;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 35228
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int h[N];
vector<int>e[N];
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i) scanf("%d",h+i);
    for(int i=1;i<=m;++i) {
        int a,b;
        scanf("%d%d",&a,&b);
        e[a].push_back(b);
        e[b].push_back(a);
    }
    int ans=0;
    for(int i=1;i<=n;++i) {
        bool hh=true;
        for(int j=0;j<int(e[i].size());++j) {
            if(h[i]<=h[e[i][j]]) {hh=false;break;}
        }
        if(hh) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 9296
// 6/13
// 3-2-3. 反転
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
// using P = pair<int, int>;
const int INF = 1e9;

int n;
struct P { double x, y; };
vector<P> p;

// 2点の距離を求める
double dist(P a, P b) {
    double dx = a.x-b.x;
    double dy = a.y-b.y;
    return sqrt(dx*dx + dy*dy);
}

// 中心点を決めた時の最遠点までの距離（→半径）
// これを最小化するようなxとyを求めたい！！！
double f(double x, double y) {
    double res = 0;
    rep(i, n) {
        res = max(res, dist((P){x, y}, p[i]));
    }
    return res;
}

// x座標を決め打った時の、yなんでもいい時の、fの最小値。
double g(double x) {
    double l = 0, r = 1000;
    rep(i, 80) {
        double c1 = (l*2+r)/3;
        double c2 = (l+r*2)/3;
        if (f(x, c1) > f(x, c2)) l = c1; else r = c2;
    }
    return f(x, l);
}

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

    // vector<int> x(N), y(N);
    // rep(i, N) cin >> x[i] >> y[i];

    // // 3つの点を通る場合は全ての組み合わせを見ても間に合う。
    // for (int i = 0; i < N; i++) {
    //     for (int j = i + 1; j < N; j++) {
    //         for (int k = j + 1; k < N; k++) {
    //         }
    //     }
    // }

    // いか、snukeさん解説
    cin >> n;
    p = vector<P>(n);
    rep(i, n) cin >> p[i].x >> p[i].y;

    // f(p)を最小化するpを求めたい。
    double l = 0, r = 1000;
    // 実数で探索するときは、適当な値を置く。大体50〜80くらい？
    rep(i, 80) {
        double c1 = (l*2+r)/3;  // lより。
        double c2 = (l+r*2)/3;  // rより。
        if (g(c1) > g(c2)) l = c1; else r = c2;  // 最小値を求めたいから大きい方を近づけていく。
    }

    double ans = g(l);
    printf("%.10f\n", ans);
    return 0;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

// 探索
vector<bool> seen, finished;

// サイクル復元のための情報
int pos = -1; // サイクル中に含まれる頂点 pos
stack<int> hist; // 訪問履歴

int turn = 0;
vector<int> poss; // 回数でどこにいたか
void dfs(const vector<int>  &G, int v) {
    // cerr << "turn " << turn << " from: " << v << " to:" << G[v]<< endl;
    poss[turn] = v;
    turn++;
    seen[v] = true;
    hist.push(v);

    auto nv = G[v];

    // サイクルを検出
    if (seen[nv] && !finished[nv]) {
        pos = nv;
        return;
    }

    // 再帰的に探索
    dfs(G, nv);

    // サイクル検出したならば真っ直ぐに抜けていく
    if (pos != -1) return;
    hist.pop();
    finished[v] = true;
}


void solve() {
    ll N,K;
    cin >> N >> K;
    vector<int> g(N);
    REP(i,N) {
        int A;
        cin >> A;
        A--;
        g[i] = A;
    }

    // 探索
    seen.assign(N, false), finished.assign(N, false); poss.resize(N);
    dfs(g, 0);

    // サイクルを復元
    set<int> cycle;

    while (!hist.empty()) {
        int t = hist.top();
        cycle.insert(t);
        hist.pop();
        if (t == pos) break;
    }

    ll X;
    // compress
    if (hist.size() + cycle.size() <= K) {
        X = (K-hist.size())%cycle.size() + hist.size();
    } else X = K;


    //cerr << "cycle size: " << cycle.size() << endl;
    //cerr << "hist size: " << hist.size() << endl;
    //cerr << "X: " << X << endl;
    cout << poss[X] +1<< endl;

}

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


Measured memory_bytes: 30524
n,x = -1,-1
table = []
while n != 0 or x != 0:
  n,x = (int(x) for x in input().split())
  table.append([n,x])

for t in table:
  n = t[0]
  x = t[1]
  if n == 0 and x == 0:
    break
  i = 1
  s = 0
  while i < n:
    #print (i)
    if x - i > n + (n - 1):
      i += 1
      continue
    else:
      j = i + 1
      while j < n:
        #print (str(i) + "," + str(j) + "," + str(x - i - j))
        if x - i - j <= n and x - i - j > j:
          s += 1
        j += 1
      i += 1
  print (s)


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

int solve1()
{
    int a,b;
    cin >> a >> b;

    if (a >= 10 || b >= 10) {
        cout << -1 << std::endl;
    } else {
        cout << a*b << std::endl;
    }

    return 0;
}

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];


int check(llong P){
	int i = 0;
	for(int j = 0; j < k; j++){
		llong s = 0;
		while(s + T[i] <= P){     //荷物の重さの合計が最大積載量を超えないうちの処理
			s += T[i];
			i++;
			if(i==n)return n;     //すべての荷物の合計が最大積載量以内のときの処理
		}
	}
	return i;
}

int solve(){
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left > 1){
		mid = (left + right) / 2;//中央値
		int v = check(mid);//中央値の値が最大積載量を超えていないか判定する
		if(v >= n)right = mid;//vが荷物の個数より多かったら、中央値をrightにする
		else left = mid;//それ以外の中央値はleft
	}
	
	return right;
}

main(){
	cin >> n >> k;//nとkを入力
	for(int i = 0;i < n;i++)cin >> T[i];
	llong ans = solve();
	cout << ans << endl;//ansとendlを出力
}


Measured memory_bytes: 3880
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};

namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}
double getarea(const VP &poly){
    double ret = 0;
    for (int i=0; i<(int)poly.size(); i++){ 
        ret += cross(poly[i], poly[(i+1)%poly.size()]);
    }
    return ret*0.5;
}

int main(){
    cout << fixed << setprecision(10);
    while(1){
        int n;
        cin >> n;
        if(n == 0) break;

        vector<int> angle(3*n);
        int mod = 360*n;
        for(int i=0; i<n; i++){
            angle[3*i] = 360*i %mod;
            angle[3*i +1] = (360*i +120*n) %mod;
            angle[3*i +2] = (360*i +240*n) %mod;
        }
        sort(angle.begin(), angle.end());
        angle.erase(unique(angle.begin(), angle.end()), angle.end());

        double r = 1/sqrt(3);
        VP p(angle.size());
        for(int i=0; i<(int)angle.size(); i++){
            double theta = angle[i] *2 *PI /mod;
            p[i] = P(r, 0) *P(cos(theta), sin(theta));
        }
        int m = p.size();
        if(m == 3){
            cout << getarea(p) << endl;
            continue;
        }

        P rot(cos(PI*2/3), sin(PI*2/3));
        VP poly;
        for(int i=0; i<m; i++){
            poly.push_back(p[i]);
            poly.push_back(crosspointLL(L(p[i], p[i]*rot), L(p[(i+1)%m], p[(i+1)%m]/rot)));
        }
        cout << getarea(poly) << endl;
    }    
    return 0;
}



Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (1<=A && A<=9 && 1<=B && B<= 9) {
			System.out.println(A * B);
		} else {
			System.out.println(-1);
		}
	}
}


Measured memory_bytes: 22996
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] A = new long[n + 1];
        int[] Aa = new int[n];
        long result = 0;
        for(int i = 0; i < n; i++) {
            Aa[i] = sc.nextInt();
            A[Aa[i]]++;
        }
        for(int i = 0; i < n + 1; i++) {
            result += A[i] * (A[i] - 1) / 2;
        }
        for(int i = 0; i < n; i++) {
            System.out.println(result - (A[Aa[i]] > 1 ? A[Aa[i]] - 1 : 0));
        }
    }
}


Measured memory_bytes: 101980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;
    vector<int> va(N), vb(N);
    vector<pii> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> va[i] >> vb[i];
        v[i] = {va[i], vb[i]};
    }
    sort(va.begin(), va.end());
    sort(vb.begin(), vb.end());

    ll ans = 0;
    if (N & 1) {
        int l = va[N >> 1], r = vb[N >> 1];
        ans = r - l + 1;
    } else {
        pii mi, ma;
        mi = {va[(N >> 1) - 1], vb[(N >> 1) - 1]};
        ma = {va[N >> 1], vb[N >> 1]};
        ans = mi.second - mi.first + ma.second - ma.first + 1;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6368
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

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

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main(){
  int N, M; cin >> N >> M;
  UnionFind<int> uf(N);
  rep(i, M){
    int l, r, d; cin >> l >> r >> d;
    l--, r--;
    if (uf.issame(l, r)){
      int diff = uf.diff(l, r);
      if (diff != d) {
        cout << "No" << endl;
        return 0;
      }
    }
    else uf.merge(l, r, d);
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <algorithm>

using namespace std;

struct Tag {
    int x, y, state;
    int cost;
    Tag(int x, int y, int s, int cost) : x(x), y(y), state(s), cost(cost) {}

    bool operator <(const Tag &other) const {
        return cost > other.cost;
    }
};

const int DX[7] = {0, 1, 1, 0, -1, -1, 0};
const int DY[2][7] = {
    {1, 0, -1, -1, -1, 0, 0}, //Even
    {1, 1, 0, -1, 0, 1, 0} //Odd
};

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

    int SX, SY, GX, GY;
    cin >> SX >> SY >> GX >> GY;
    int N;
    cin >> N;
    vector<vector<int> > movable(201, vector<int>(201, 1));
    vector<vector<vector<int> > > memo(201, vector<vector<int> >(201, vector<int>(6, INT_MAX)));
    for(int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        movable[y+100][x+100] = 0;
    }
    int LX, LY;
    cin >> LX >> LY;

    int ans = -1;
    priority_queue<Tag> q;
    q.push(Tag(SX, SY, 0, 0));
    while(!q.empty()) {
        Tag t = q.top();
        q.pop();
        if(t.x == GX && t.y == GY) {
            ans = t.cost;
            break;
        }
        if(memo[t.y+100][t.x+100][t.state] < t.cost) continue;
        memo[t.y+100][t.x+100][t.state] = t.cost;

        const int nocost = abs(t.x * t.y * t.state) % 6;
        for(int i = 0; i < 7; ++i) {
            const int nx = t.x + DX[i];
            const int ny = t.y + DY[t.x&1][i];
            const int nt = (t.state + 1) % 6;
            if(nx < -LX || nx > LX || ny < -LY || ny > LY) continue;
            if(!movable[ny+100][nx+100]) continue;
            int cost = t.cost + (i == nocost ? 0 : 1);
            if(memo[ny+100][nx+100][nt] > cost) {
                memo[ny+100][nx+100][nt] = cost;
                q.push(Tag(nx, ny, nt, cost));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;

    public void go() throws IOException
    {
        ntok();
        String[] arr = {"Sunny", "Cloudy", "Rainy"};
        String s = spar();
        for (int i = 0; i < 3; i++)
        {
            if (s.equals(arr[i]))
            {
                out.println(arr[(i+1)%3]);
            }
        }

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public int[] iapar(int n)
    {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = ipar();
        }
        return arr;
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public long[] lapar(int n)
    {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = lpar();
        }
        return arr;
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

    public static void main(String[] args) throws IOException
    {
        new Main().go();
    }
}


Measured memory_bytes: 20692
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAddSubMul solver = new AAddSubMul();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAddSubMul {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int sum = a + b;
            int sub = a - b;
            int mul = a * b;
            out.print(sum >= sub && sum >= mul ? sum : sub >= sum && sub >= mul ? sub : mul);
        }

    }

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

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

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

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

        public void close() {
        }

    }
}



Measured memory_bytes: 21460
N = int(input())
L = list(map(int, input().split()))
count = 0
L_sort = sorted(L)
length = len(L_sort)
# 最長辺以外の辺の長さの和 > 最長辺の辺の長さ のとき三角形が成り立つ

for i in range(0, length-2):
    for j in range(i+1, length-1):
        if L_sort[i] == L_sort[j]:
            continue
        for k in range(j+1, length):
            if L_sort[j] == L_sort[k]:
                continue
            if L_sort[i] + L_sort[j] > L_sort[k]:
                count += 1
print(count)

Measured memory_bytes: 9200
/*input
7
zenkoku
touitsu
program
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i, j, k)  for(int i = j; i <  k; ++i)
#define RREP(i, j, k) for(int i = j; i >= k; --i)
#define F first
#define S second
#define mp make_pair
#define pb emplace_back
#define PII pair<int , int>
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX 
#define INF 0x3f3f3f3f

string a , b , c;
int ans = 0;
int32_t main(){
    IOS;
    cin >> a >> a >> b >> c;
    REP(i , 0 , a.size()){
        set<char> cc;
        cc.insert(a[i]);
        cc.insert(b[i]);
        cc.insert(c[i]);
        if(cc.size() == 1);
        if(cc.size() == 2) ans += 1;
        if(cc.size() == 3) ans += 2;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    string a, b;
    cin >> a >> b;

    int num = stoi(a + b);
    for (int i = 0; i <= (int)floor(sqrt(num)); i++) {
        if (i * i == num) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

using namespace std;

#define ll long long

template<typename T>
struct WarshallFloyd {
	const T INF = numeric_limits<T>::max();
	int n;
	vector<vector<T>> g;
	/* コンストラクタ */
	// n : 頂点数
	WarshallFloyd(int n) {
		this->n = n;
		g.resize(n, vector<T>(n, INF));
		for (int i = 0; i < n; ++i)
			g[i][i] = (T)0;
	}
	/* 辺を張る */
	// iからjに辺を張る、fが0以外の時は有向辺、0なら無向辺
	void add_edge(int i, int j, T cost, int f = 0) {
		g[i][j] = cost;
		if (f == 0)
			g[j][i] = cost;
	}
	/* Warshall-Floyd法により全点対間最短距離を求め、gを更新 */
	void calc() {
		for (int k = 0; k < n; ++k)
			for (int i = 0; i < n; ++i)
				for (int j = 0; j < n; ++j)
					if (g[i][k] != INF && g[k][j] != INF)
						g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
	}
};

int main() {
	int v, e; cin >> v >> e;
	WarshallFloyd<ll> wf(v);
	while (e--) {
		int s, t; ll d;
		cin >> s >> t >> d;
		wf.add_edge(s, t, d, 1);
	}
	wf.calc();
	// 負閉路の検出のためにもう一度WFする
	WarshallFloyd<ll> tmp = wf;
	tmp.calc();
	// 負閉路の判定
	for (int i = 0; i < v; ++i) {
		for (int j = 0; j < v; ++j) {
			if (wf.g[i][j] != tmp.g[i][j]) {
				cout << "NEGATIVE CYCLE" << endl;
				goto END;
			}
		}
	}
	// そうでない場合
	for (int i = 0; i < v; ++i) {
		for (int j = 0; j < v; ++j) {
			if (wf.g[i][j] != wf.INF) cout << wf.g[i][j];
			else cout << "INF";
			if (j != v - 1) cout << " ";
		}
		cout << endl;
	}
END:;
	return 0;
}


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

int main(){
    long long n, a, b;
    cin >> n >> a >> b;
    long long ans;
    ans = n/(a+b)*a;
    ans += n%(a+b)>=a?a:n%(a+b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/tenka1-2018/tasks/tenka1_2018_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (auto &x : A) {
        cin >> x;
    }
    sort(ALL(A));
    int idxS = 0, idxE = N - 1;
    bool flag = false;
    if (N % 2 == 1) {
        if (abs(A[N / 2] - A[N / 2 + 1]) < abs(A[N / 2] - A[N / 2 - 1])) {
            B[0] = A[N / 2];
            B[N - 1] = A[N / 2 + 1];
        } else {
            B[0] = A[N / 2];
            B[N - 1] = A[N / 2 - 1];
            flag = true;
        }
    } else {
        B[0] = A[N / 2];
        B[N - 1] = A[N / 2 - 1];
    }
    FOR(i, 1, N - 1) {
        if (i % 2 != flag) {
            B[i] = A[idxS++];
        } else {
            B[i] = A[idxE--];
        }
    }
    int sum = 0;
    REP(i, N - 1) { sum += abs(B[i] - B[i + 1]); }
    cout << sum << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 4768
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;
typedef long double ld;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

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

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

void solve(){

	ll ans=0;
	ll a,b;
	cin>>a>>b;

	ans=a*b;

	cout<<ans<<endl;
	
}


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


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N = 2e5 + 100;
char s[N];

int main() {
		
	scanf("%s", s + 1);
	int num = 0;
	long long ans = 0;
	int n = strlen(s + 1);
	
	for(int i = 1; i <= n; i++) {
		if(s[i] == 'W') {
			num++;
			ans += i-num;
		}
	}
	
	cout << ans << endl;
	
	return 0;	
} 

Measured memory_bytes: 3416
N = int(input())
A = [0]*(N+1)
L = int(N**0.5)+1
for x in range(1,L+1):
    for y in range(1,L+1):
        for z in range(1,L+1):
            num = x*x+y*y+z*z+x*y+y*z+z*x
            if num <= N:
                A[num] += 1
    

for i in range(1,N+1):
    print(A[i])
    

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

int main()
{
  ll k;
  cin >> k;
  ll rem = 0;
  for(int i = 0; i < k; i++){
    rem = rem*10 + 7;
    rem = rem%k;
    if(rem == 0){
      cout << i + 1 <<  endl;
      return 0;
    }
 //   cout << -1 <<  " " << rem << endl;
  }
  cout << -1 << endl;
  return 0;
}

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

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

    map<string, int> mp;
    for(int i = 0; i < N; i++){
      string s;
      cin >> s;
      mp[s] = mp[s]+1;
    }
    
    multimap<int, string, greater<int>> m;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
      m.insert(make_pair(itr->second, itr->first));
    }
  
    bool first = true;
    int ma;
    for (auto const& entry: m)
    {
       if(first) {ma=entry.first;first = false;}
        if(ma!=entry.first)break;
        std::cout << entry.second << endl;
    }

    return 0;
}

Measured memory_bytes: 37760
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize, a: usize, b: usize,
    }

    let d = n / (a + b);
    let m = n % (a + b);
    if m <= a {
        println!("{}", a * d + m);
    } else {
        println!("{}", a * d + a);
    }
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  vector<int> ans(n);
  vector<int> count(n);
  for(int i=0;i<m;i++){
    cin >> s[i] >> c[i];
  }
  for(int i=0;i<m;i++){
    int x=s[i]-1;
    int y=c[i];
    if(n>1&&x==0&&y==0){
      cout << -1 << endl;
      return 0;
    }else if(count[x]!=0&&ans[x]!=y){
      cout << -1 << endl;
      return 0;
    }else{
      ans[x] = y;
      count[x] += 1;
    }
  }
  for(int i=0;i<n;i++){
    if(n>1&&i==0&&ans[i]==0){
      cout << 1;
    }
    /*else if(ans[i]==0){
      cout << 0;
    }*/
    else{
      cout << ans[i];
    }
  }
}

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

int main(int argc, char *argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> a, b, c;
    for(int i = 0; i < n; ++i) {
        int aa, bb, cc;
        cin >> aa >> bb >> cc;
        a.emplace_back(aa);
        b.emplace_back(bb);
        c.emplace_back(cc);
    }

    vector<vector<int>> dp(3, vector<int>(n, numeric_limits<int>::min()));
    dp[0].back() = a.back();
    dp[1].back() = b.back();
    dp[2].back() = c.back();

    vector<int>* abc[3] = {&a, &b, &c};
    for(int i = n - 1; i >= 0; --i) {
        for(int j = 0; j < 3; ++j) {
            for(int k = 0; k < 3; ++k) {
                if(k == j) continue;
                dp[j][i] = max(dp[j][i], (*abc[j])[i] + dp[k][i + 1]);
            }
        }
    }

    cout << max(dp[0][0], max(dp[1][0], dp[2][0])) << '\n';
}


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

int main() {
    string s; cin >> s;
    long long _ = 1, a = 0, ab = 0, abc = 0;
    for (char ch: s) {
        if (ch == 'A') a += _;
        if (ch == 'B') ab += a;
        if (ch == 'C') abc += ab;
        if (ch == '?') {
            abc = abc * 3 + ab;
            ab = ab * 3 + a;
            a = a * 3 + _;
            _ *= 3;
        }
        a %= MOD, ab %= MOD, abc %= MOD, _ %= MOD;
    }
    cout << abc << endl;
    return 0;
}


Measured memory_bytes: 512
N=int(input())
if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9 :
    print("hon")
elif N%10==0 or N%10==1 or N%10==6 or N%10==8 :
    print("pon")
else:
    print("bon")

Measured memory_bytes: 8944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int D;
  cin >> D;
  if(D==25){
    cout << "Christmas" << endl;
  }else if(D==24){
    cout << "Christmas Eve" << endl;
  }else if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }else if(D==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
solve (a:b:as) | a <= b = a : solve (b:as)
               | otherwise = b : solve (b:as)
solve (a:as) = [a]
solve [] = []

main = do
    n <- readLn :: IO Int
    bn <- map read . words <$> getLine :: IO [Int]
    print $ sum $ (head bn) : (solve bn)

Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

signed main() {
  ll X;
  cin >> X;

  rep(i, 10) {
    rep(j, 10) {
      if (i * j == X) {
        COUT("Yes");
        return 0;
      }
    }
  }
  COUT("No");

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0
#define all(x) x.begin(), x.end()


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

int n;
char check[1010][82];
char field[1010][82];
map<int,int> mii;

bool inside(int x, int y){
  return !(x>=80 || y>=n || x<0 || y<0 || field[y][x]==0 );
}

void dfs(int x, int y, int d, vector<pair<int,int> >& v){
  int tx = x + dx[d];
  int ty = y + dy[d];

  if( check[y][x] ) return;
  check[y][x] = 1;

  if( inside(tx,ty) && field[ty][tx]=='*' ){
    dfs(tx,ty,d,v);
  }else{
    v.push_back(make_pair(x,y));
    rep(k,8){
      tx = x + dx[k];
      ty = y + dy[k];
      if( !inside(tx,ty) || field[ty][tx]==' ' || check[ty][tx] )continue;
      dfs(tx,ty,k,v);
    }
  }
}

int main(){
  string in;
  for(int t=0; cin>>n,n; t++){
    cin.ignore();
    memset(field,0,sizeof(field));
    memset(check,0,sizeof(check));
    mii.clear();
    if( t>0 )puts("----------");
    
    rep(i,n){
      getline(cin,in);
      strcpy(field[i], in.c_str());
    }
    rep(i,n){
      for(int j=0; field[i][j]!='\0'; j++){
	if( field[i][j]=='*' && !check[i][j] ){
	  int d = -1;
	  rep(k,8){
	    int tx = j + dx[k];
	    int ty = i + dy[k];
	    if( !inside(tx,ty) || field[ty][tx]==' ' ) continue;
	    d = k;
	    break;
	  }
	  vector<pair<int,int> > v;
	  v.push_back(make_pair(j,i));
	  dfs(j, i, d, v);

#if DEB
	  rep(k,v.size()){
	    printf("(%d,%d)\n",v[k].first, v[k].second);
	  }
#endif
	  
	  int sum = ((v[1].first-v[0].first+1)+(v[2].first-v[3].first+1))*(v[3].second-v[0].second+1)/2;
	  //int sum = ((v[3].first-v[0].first+1)+(v[2].first-v[1].first+1))*(v[1].second-v[0].second+1)/2;
	  mii[sum]++;
	}
      }
    }
    map<int,int>::iterator it;
    for(it=mii.begin(); it!=mii.end(); it++){
      printf("%d %d\n",it->first, it->second);
    }
#if DEB
    rep(i,n){
      rep(j,81){
	printf("%d",check[i][j]);
      }
      puts("");
    }
#endif
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <random>

using ll = long long int;
using P = std::pair<ll, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

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

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int l[30];
ll c[30],s[400][30],ans[150000];
std::vector<int> v[150000];

int main(void){
	int d,i,j,n=26,k,m=125000;
	ll ansm = -INFLL;
	for(k=0; k<m; ++k){
		for(j=0; j<n; ++j){
			v[k].push_back(j);
		}
		std::random_device seed_gen;
		std::mt19937 engine(seed_gen());
		std::shuffle(v[k].begin(), v[k].end(), engine);
	}
	std::cin >> d;
	for(i=0; i<26; ++i){
		std::cin >> c[i];
	}
	for(i=0; i<d; ++i){
		for(j=0; j<n; ++j){
			std::cin >> s[i][j];
		}
	}
	for(k=0; k<m; ++k){
		for(j=0; j<n; ++j){
			l[j] = -1;
		}
		for(i=0; i<d; ++i){
			ans[k] += s[i][v[k][i%26]];
			l[v[k][i%26]] = i;
			for(j=0; j<n; ++j){
				ans[k] -= c[j]*(i-l[j]);
			}
		}
		ansm = std::max(ansm,ans[k]);
		// std::cout << ans[k] << std::endl;
	}
	for(k=0; k<m; ++k){
		if(ans[k] == ansm){
			for(i=0; i<d; ++i){
				std::cout << v[k][i%26]+1 << std::endl;
			}
			break;
		}
	}
	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6 && a <= 12) {
        cout << b / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
// ref: https://img.atcoder.jp/abc112/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

//     vH[i] = ch-abs(vX[i]-cx)-abs(vY[i]-cy)
// <=> vH[i] = ch-abs(vX[i]-cx)-abs(vY[i]-cy)
// <=> vH[i]     +abs(vX[i]-cx)+abs(vY[i]-cy) = ch
// <=> ch = vH[i]+abs(vX[i]-cx)+abs(vY[i]-cy)

tuple<bool,int> isSameH(int cx, int cy,
             const vector<int>& vX, const vector<int>& vY, const vector<int>& vH){
    int ch;
    for(uint i=0; i<vH.size(); ++i){
        if(vH[i]<=0){ continue; }
        ch = max(vH[i]+abs(vX[i]-cx)+abs(vY[i]-cy), 0);
        break;
    }
    
    for(uint i=0; i<vH.size(); ++i){
        int htmp = max(ch-abs(vX[i]-cx)-abs(vY[i]-cy), 0);
        if(vH[i]!=htmp){ return make_pair(false, ch); }
    }
    return make_pair(true, ch);
}
tuple<int, int, int> solver(const vector<int>& vX, const vector<int>& vY, const vector<int>& vH){
    for(int cx=0; cx<=100; ++cx){
        for(int cy=0; cy<=100; ++cy){
            bool TF; int ch;
            tie(TF, ch) = isSameH(cx, cy, vX, vY, vH);
            if( TF ){ return make_tuple(cx, cy, ch); }
        }
    }
    return make_tuple(-1, -1, -1);
}

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    uint N; cin >> N;
    vector<int> vX(N), vY(N), vH(N);
    for(uint i=0; i<N; ++i){ cin >> vX[i] >> vY[i] >> vH[i]; }
    
    int cx=0, cy=0, ch=0;
    tie(cx, cy, ch) = solver(vX, vY, vH);
    cout << cx << ' ' << cy << ' ' << ch << endl;
    
    return 0;
}

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

using namespace std;
const long long INF = 1LL <<60;

int main(void){
  long long N,W;
  cin>>N>>W;
  long long w[N+1],v[N+1];
  long long i,j,k;
  long long MAX_v=N*1000;
  long long dp[N+1][MAX_v+1];
  
  for(j=0;j<=MAX_v;j++){
    dp[0][j]=INF;
  }
  
  for(i=0;i<N;i++){
    cin>>w[i]>>v[i];
    dp[i][0]=0;
    for(j=1;j<=v[i];j++){
      dp[i+1][j]=min(dp[i][j],w[i]);
      //cout<<dp[i][j]<<" ";
      //cout<<i<<" "<<j<<" ";
    }
    for(j=v[i];j<=MAX_v;j++){
      dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      //cout<<dp[i+1][j]<<" ";
      //cout<<i<<" "<<j<<" ";
    }
    //cout<<endl;
  }
  for(j=0;j<=MAX_v;j++){
      if(dp[N][j]>W){
        cout<<j-1<<endl;
        return 0;
      }
  }
  cout<<j-1<<endl;
  return 0;
}

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

using namespace std;

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

  vector<long int> A(N);

  long int sum = 0;
 
  for(int i = 0; i < N; i++){
    cin >> A[i];
   
  }


  long int max = -100;
  if(A[0] + K - A[N - 1] > max){
    max = A[0] + K - A[N - 1];
   }

   for(long int i = 1; i < N; i++){
     if(max < A[i] - A[i - 1]){ max = A[i] - A[i - 1]; }
   }

   cout << K - max;
   
  return 0;
}


Measured memory_bytes: 1792
import sys
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
for z in d:
	x, y = z
	if x == y:
		cnt += 1
		if cnt >= 3:
			print("Yes")
			sys.exit()
	else:
		cnt = 0
print("No")

Measured memory_bytes: 62560
#include <stdio.h>
#include <string.h>
int main(void){
    char s[1000000], t[1000000];
    int c=0, i;
    
    scanf("%s",s);
    scanf("%s",t);
    
    for(i=0;i<strlen(t);i++){
        if(s[i]!=t[i]) c++;
    }
    printf("%d\n",c);
    return 0;
}

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

using namespace std;

#define ll long long

const int N = 2e5+15,M = 30;

int g[M][N];

int a[N],b[N];


int Count(int pos,ll small,ll big,ll x,int n){

    small-=x,big-=x;
    int l = lower_bound(g[pos]+1,g[pos]+1+n,small)-g[pos];
    int r = lower_bound(g[pos]+1,g[pos]+1+n,big)-g[pos];--r;

    return max(0,r-l+1);
}
int main(){
    //freopen("input.txt","r",stdin);

    int n;
    cin>>n;
    for(int i=1;i<=n;++i)scanf("%d",&a[i]);

    for(int i=1;i<=n;++i)scanf("%d",&b[i]);

    for(int i=1;i<=n;++i){
        int bit=0;
        for(int j=0;j<M;++j){
            if(a[i]&(1<<j)){
                bit+= 1<<j;
            }
            g[j][i]= bit;
        }
   }
   for(int j=0;j<M;++j)
        sort(g[j]+1,g[j]+1+n);
    int ret=0;

    int l,r,C;
    ll s,big;
    for(int i=1;i<=n;++i){
        int bit = 0;
        for(int j=0;j<M;++j){
            if(b[i]&(1<<j)){
                bit += (1<<j);
            }
            s = (1LL<<j);
            big = (1LL<<(j+1));
            C= Count(j,s,big,bit,n);
            s+= (1LL<<(j+1));
            big+= (1LL<<(j+1));
            C+= Count(j,s,big,bit,n);
            if(C&1)
                ret ^= (1<<j);
        }
    }
    cout<<ret<<endl;

}

Measured memory_bytes: 25216
n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(n):
	C,*A=map(int,input().split())
	c.append(C)
	a.append(A)

ans=[]
for i in range(2**n):
	A=[0]*m
	C=0
	lst=list(map(int,format(i,'b').zfill(n)))
	for j in range(n):
		if lst[j]==1:
			C+=c[j]
			for k in range(m):
				A[k]+=a[j][k]
	if all(elem>=x for elem in A):
		ans.append(C)
if len(ans):
	print(min(ans))
else:
	print(-1)

Measured memory_bytes: 9184
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	int a[100000], b[100000];
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));

	cin >> n;

	int m = n / 2;

	for (int i = 0; i < m; i++) {
		int s, t;
		cin >> s >> t;
		a[s - 1]++;
		b[t - 1]++;
	}

	int im = 1, km = 1, am, bm;

	for (int i = 0; i < 100000; i++) {
		if (im < a[i]) {
			im = a[i];
			am = i;
		}
		if (km < b[i]) {
			km = b[i];
			bm = i;
		}
	}

	if (am == bm) {
		int as = 0, bs = 0;
		for (int i = 0; i < 100000; i++) {
			if (i != am && as < a[i])
				as = a[i];	
			if (i != am && bs < b[i])
				bs = b[i];
		}
		cout << n - max(im + bs, km + as) << endl;
	}
	else
		cout << n - (im + km) << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;

int main()
{
    int a[3];
    rep(i,3)cin>>a[i];
    sort(a,a+3);
    cout<<a[2]-a[0]<<endl;

    return 0;
}


Measured memory_bytes: 256