akhauriyash/Code-Regression huggingface dataset:
"""
# 標準入力取得
## 文字列
 = 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(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd


mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    l = list(sys.stdin.readline().split())

    #リストを使い回すのは危険。ソートなど意図しない変更がかかっているかも。
    b = l[:]#リスト丸々コピー
    s = l[:]

    def BubbleSort(l,n):
        for i in range(n):
            for j in range(1,n):
                if l[j][1] < l[j-1][1]:
                    temp=l[j-1]
                    l[j-1]=l[j]
                    l[j]=temp

    def SelectionSort(l,n):
        for i in range(n):
            minj=i
            for j in range(i,n):
                if l[j][1] < l[minj][1]:
                    minj = j
            if i!=minj:
                temp=l[minj]
                l[minj]=l[i]
                l[i]=temp

    BubbleSort(b,n)
    print(*b)
    print('Stable')
    SelectionSort(s,n)
    print(*s)
    #真ならば前、偽ならば後ろ
    print("Stable" if b==s else "Not stable")





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

int main() {
  string N;
  cin >> N;
  int sum = 0;
  for (auto &i : N) sum += i - '0';
  if (sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  int A, B;
  cin >> A >> B;
  cout << A* B << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] xy = new int[n][2];
        for (int i = 0; i < n; i++) {
            xy[i][0] = sc.nextInt();
            xy[i][1] = sc.nextInt();
        }
        double sum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                sum += Math.sqrt(Math.pow(xy[i][0] - xy[j][0], 2)
                        + Math.pow(xy[i][1] - xy[j][1], 2));
            }
        }
        System.out.println(2 * sum / n);
    }

}


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

int main()
{
	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int w,n;
	int tatesenn[100];
	int i,c,t;
	int a,b;

	scanf("%d",&w);
	scanf("%d",&n);

	for(i=1;i<=w;i++){
		tatesenn[i]=i;
	}

	for(i=1;i<=n;i++){
		scanf("%d,%d",&a,&b);
		t=tatesenn[b];
		tatesenn[b]=tatesenn[a];
		tatesenn[a]=t;
	}

	for(i=1;i<=w;i++){
		printf("%d\n",tatesenn[i]);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int K;
    cin >> K;

    ll c = 0;
    FOR(h, 1, K + 1) {
        FOR(i, 1, K + 1) {
            FOR(j, 1, K + 1) {
                int r1 = gcd(h, i);
                int r2 = gcd(r1, j);
                /*
                int a1, a2;
                a1 = max({h, i});
                a2 = min({h, i});
                int r = a1 % a2;
                while (r != 0) {
                    a1 = a2;
                    a2 = r;
                    r = a1 % a2;
                }
                r = a2;
                a1 = max({r, j});
                a2 = min({r, j});
                r = a1 % a2;
                while (r != 0) {
                    a1 = a2;
                    a2 = r;
                    r = a1 % a2;
                }
                */
                c += r2;
            }
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#define RE(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define SZ(x) ((int)(x.size()))
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using C = complex<double>;
const double PI = 3.14159265;
const double eps = 1e-8;
const int N = 1e6 +10;
const int M = 1e9 + 7;
const int inf = 1e9+7;
const ll INF = 1e18;
ll pw(ll a, ll b){ll t=1;a%=M;for(;b;b>>=1){if(b&1){t=t*a%M;}a=a*a%M;}return t;}
ll gcd(ll a, ll b){return b?gcd(b, a%b): a;}

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int a, b, c;
	cin>>a>>b>>c;
	if(a+b+c>=22){
        cout<<"bust\n";
	}
	else cout<<"win\n";
}

/*
#ifdef DEBUG
	cout<<"I Love Co shu Nie [ https://coshunie.com/ ]"
#endif
*/





Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  vector<long long>A(N);
  vector<long long>B(N);
  B.at(0) = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if (i != 0){
      if (A.at(i) > A.at(i-1)){
        B.at(i) = 1;
      }
      else if (A.at(i) < A.at(i-1)){
        B.at(i) = -1;
      }
      else {
        B.at(i) = 0;
      }
    }
  }
  
  long long money = 1000;
  long long kabu = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0){
      if (B.at(i+1) > B.at(i)){
        kabu += money / A.at(i);
        money = money % A.at(i);
      }
    }
    else if (i != N-1){
      if (B.at(i-1) <= B.at(i) && B.at(i) > B.at(i+1)){
        money += kabu * A.at(i);
        kabu = 0;
      }
      else if (B.at(i-1) >= B.at(i) && B.at(i) < B.at(i+1)){
        kabu += money / A.at(i);
        money = money % A.at(i);
      }
    }
    else {
      money += kabu * A.at(i);
      kabu = 0;
    }   
  }
  long long C = 1000;
  cout << max(money,C) << endl;
}
      
        
      




Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

/* add vars here */

typedef struct complex {
  int r,i;
} complex;

complex z1, z2;

/* add your algorithm here */

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  int x3,y3,x4,y4;
  int x, y;

  x = c - a, y = d - b;

  x3 = c + b - d;
  y3 = d - a + c;
  x4 = a + b - d;
  y4 = b - a + c;

  printf("%d %d %d %d\n", x3, y3, x4, y4);
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void){
int M[100], F[100], S[100], i = 0, j;
M[0] = 1;
F[0] = 1;
S[0] = 1;

while( M[i] != -1 || F[i] != -1 || S[i] != -1){
	i++;
	scanf("%d %d %d", &M[i], &F[i] ,&S[i]);
	}
for(j = 1; j < i; j++){
	if( M[j] == -1 || F[j] == -1){
		printf("F\n");
		}
	else{
		if( ( M[j] + F[j] ) >= 80 ){
		printf("A\n");
		}
		else if( ( M[j] + F[j] ) >= 65 ){
			printf("B\n");
		}
		else if( ( M[j] + F[j] ) >= 50 ){
			printf("C\n");
		}
		else if( ( M[j] + F[j] ) >= 30 ){
			if( S[j] >= 50 ){
				printf("C\n");
			}
			else{
				printf("D\n");
			}
		}
		else{
		printf("F\n");
		}
	}

}
return 0;
} 

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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int N = in.nextInt();
			int[] x = in.nextIntArray(N);
			int[] y = Arrays.copyOf(x, N);

			Arrays.sort(y);

			int lm = y[N/2-1];
			int rm = y[N/2];

			for (int i = 0; i < N; i++) {

				if (x[i] <= lm) {
					out.println(rm);
				} else {
					out.println(lm);
				}

			}
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

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

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 53736
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long, long long>
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define MAXN 10000057
#define mod 998244353
#define fr(i, s, e, st) for(ll (i) = (s); (i) < (e); (i) += (st))
#define fre(i, s, e, st) for(ll (i) = (s); (i) <= (e); (i) += (st))
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);

using namespace std;

int main()
{
    fastio;
    ll T = 1;
    //cin >> T;
    //sieve();
    while (T--)
    {
        ll n, d, sum = 0; map<ll, ll> m;
        cin>>n;
        ll a[n];
        fr(i, 0, n, 1) cin>>a[i], m[a[i]]++;
        for(map<ll, ll>::iterator it=m.begin(); it!=m.end(); it++)
        {
            sum += (*it).second * ((*it).second-1)/2;  
        }
        fr(i, 0, n, 1)
        {
            ll val = m[a[i]];
            cout<<(sum - (val * (val-1)/2) + ((val-1)*(val-2)/2))<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 11136
N = int(input())
A_li = list(map(int, input().split()))
ans = 0
while True:
    for i in range(N):
        if A_li[i] % 2 == 1:
            print(ans)
            exit()
        A_li[i] = int(A_li[i] / 2)
    ans += 1  


Measured memory_bytes: 3060
import Control.Applicative

main = do
  [n,a,b] <- map read . words <$> getLine :: IO [Int]

  putStrLn $ solve n a b 0

  where
    solve n a b 0 = if a+1 == b then if a == 1 then "Borys" else solve n (a-1) b 1 else solve n (a+1) b 1
    solve n a b 1 = if b-1 == a then if b == n then "Alice" else solve n a (b+1) 0 else solve n a (b-1) 0


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)

/////////////////////////////////////////////////////////

void Main(){
  int N; cin >> N;
  int n1, n2, n4;
  n1 = n2 = n4 = 0;
  rep(i, 0, N){
    int a; cin >> a;
    if(a % 4 == 0) n4++;
    else if(a % 2 == 0) n2++;
    else n1++;
  }
  if(n4 == 0){
    if(n2 == N) cout << "Yes" << endl;
    else cout << "No" << endl;
  }else{
    if(n4 * 2 + n2 >= N || n4 >= N / 2) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 256
class Arrow
  attr_reader :source, :sink, :label
   
  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
  end
end
 
class Result
  attr_reader :target, :spell
 
  def initialize(target, spell)
    @target = target
    @spell = spell
  end
end
 
def advance(table, n, goes, arrows)
  (0...n).each do |node|
    best = table[node]
    goes[node].each do |arrow|
      result = table[arrow.sink]
      next unless result
      test = arrow.label + result.spell
      if !best || test < best.spell
        best = Result.new(arrow.sink, test)
      end
    end
    table[node] = best if best
  end
end
 
def has_cycle(table, result, n)
  used = [false] * n
  loop do
    node = result.target
    return false unless node
    return true if used[node]
    used[node] = true
    result = table[node]
  end
end
 
def work(n, arrows, start, goal)
  goes = (0...n).map{[]}
  arrows.each do |arrow|
    goes[arrow.source] << arrow
  end
  table = [nil] * n
  table[goal] = Result.new(nil, '')
  n.times do
    advance(table, n, goes, arrows)
  end
  return nil unless table[start]
  (n*5).times do
    advance(table, n, goes, arrows)
  end
  result = table[start]
  has_cycle(table, result, n) ? nil : result.spell
end
 
loop do
  n, a, s, g = STDIN.gets.split.map(&:to_i)
  break if n == 0
 
  arrows = (0...a).map do |i|
    x, y, lab = STDIN.gets.split
    x = x.to_i
    y = y.to_i
    Arrow.new(x, y, lab)
  end
 
  start = s
  goal = g
 
  puts work(n, arrows, start, goal) || 'NO'
end

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

string s;
int ans = 0, c = 0;

int main() {
	cin >> s;
	 for(int i = 0; i < s.length(); i++) {
		 if (c < s.length() - i) {
			 if (s[i] == 'g')c++;
			 else c--;
		 }
		 else {
			 if (s[i] == 'g')ans++;
		 }
	}

	 cout << ans << endl;
}

Measured memory_bytes: 512
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

d = [(1,0),(-1,0),(0,1),(0,-1)]
def solve():
    h,w = LI()
    s = [input() for i in range(h)]
    bfs = [[0]*w for i in range(h)]
    bfs[0][0] = 1
    q = deque([(0,0)])
    gy,gx = h-1,w-1
    while q:
        y,x = q.popleft()
        if (y,x) == (gy,gx):
            break
        nb = bfs[y][x] + 1
        for dy,dx in d:
            ny,nx = y+dy,x+dx
            if 0 <= ny < h and 0 <= nx < w:
                if s[ny][nx] == "#":
                    continue
                if not bfs[ny][nx]:
                    bfs[ny][nx] = nb
                    q.append((ny,nx))
    ans = bfs[gy][gx]
    if not ans:
        print(-1)
        return
    c = sum([i.count("#") for i in s])
    print(h*w-c-ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


void solve(){
    int a, b, c, d; cin>>a>>b>>c>>d;
    int t=1;
    while(a>0 && c>0){
        if(t==1){
            c-=b;
            t=0;
            if(c<=0){
                cout<<"Yes";
                return;
            }
        }
        else{
            a-=d;
            t=1;
            if(a<=0){
                cout<<"No";
                return;
            }
        }
    }
}

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    solve();
    return 0;
}





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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' 
      || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int n,m,x,i,a[100],b,c,c1,c2;
	cin>>n>>m>>x;
	for(i=0;i<=n;i++){
		a[i]=0;
	}
	for(i=0;i<m;i++){
		cin>>b;
		a[b]=1;
	}
	c1=0;
	c2=0;
	for(i=0;i<=x;i++){
		c1=c1+a[i];
	}
	for(i=x;i<=n;i++){
		c2=c2+a[i];
	}
	if(c1<c2) c=c1;
	else c=c2;
	cout<<c<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"[";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"]";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&p)
{o<<"{"<<p.first<<", "<<p.second<<"}";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj)
{o<<"{";for(auto itr=obj.begin();itr!=obj.end();++itr)o<<(itr!=obj.begin()?", ":"")<<*itr;o<<"}";return o;}

int main()
{
  int N,Q;
  cin >> N >> Q;
  vector<vector<int>> event;
  multiset<int> ms;

  for(int i=0; i<N; i++){
    int s,t,x;
    cin >> s >> t >> x;
    event.push_back({s-x,1,x});
    event.push_back({t-x,-1,x});
  }
  sort(event.begin(),event.end());
  //cout << event << endl;
  
  auto itr = event.begin();
  bool endflag = false;
  for(int i=0; i<Q; i++){
    int d;
    cin >> d;
    while(itr != event.end() && (*itr)[0] <= d){
      auto tmp = (*itr);
      if(tmp[1] == 1){
        ms.insert(tmp[2]);
      }else{
        ms.erase(tmp[2]);
      }
      itr++;
    }

    int ans = ms.empty() ? -1 : (*ms.begin());
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 33064
class Dice:
    def __init__(self, x):
        self.top = x[0]
        self.front = x[1]
        self.right = x[2]
        self.left = x[3]
        self.back = x[4]
        self.bottom = x[5]
        self.list = x

    def N(self):
        self.top, self.front, self.bottom, self.back = self.front, self.bottom, self.back, self.top

    def E(self):
        self.top, self.right, self.bottom, self.left = self.left, self.top, self.right, self.bottom

    def S(self):
        self.top, self.front, self.bottom, self.back = self.back, self.top, self.front, self.bottom

    def W(self):
        self.top, self.right, self.bottom, self.left = self.right, self.bottom, self.left, self.top

    def up_front_to_right(self, top, front):
        if (top, front) in [(self.top, self.front), (self.front, self.bottom), (self.bottom, self.back), (self.back, self.top)]:
            return self.right
        elif (top, front) in [(self.front, self.top), (self.bottom, self.front), (self.back, self.bottom), (self.top, self.back)]:
            return self.left
        elif (top, front) in [(self.left, self.front), (self.front, self.right), (self.right, self.back), (self.back, self.left)]:
            return self.top
        elif (top, front) in [(self.front, self.left), (self.right, self.front), (self.back, self.right), (self.left, self.back)]:
            return self.bottom
        elif (top, front) in [(self.top, self.left), (self.left, self.bottom), (self.bottom, self.right), (self.right, self.top)]:
            return self.front
        elif (top, front) in [(self.left, self.top), (self.bottom, self.left), (self.right, self.bottom), (self.top, self.right)]:
            return self.back
        else:
            return -1

    def inverse(self, a):
        if a == self.top:
            return self.bottom
        elif a == self.front:
            return self.back
        elif a == self.right:
            return self.left
        elif a == self.left:
            return self.right
        elif a == self.back:
            return self.front
        elif a == self.front:
            return self.back
        else:
            return -1


def same(dice0, dice1):
    x = dice0.list
    for i in range(6):
        for j in range(i + 1, 6):
            if x[i] != dice0.inverse(x[j]):
                a = dice0.up_front_to_right(x[i], x[j])
                b = dice1.up_front_to_right(x[i], x[j])
                if a != b:
                    return False
    return True


n = int(input())
X = []
for i in range(n):
    *x, = map(int, input().split())
    X.append(Dice(x))
for i in range(n):
    for j in range(i + 1, n):
        if same(X[i], X[j]):
            print('No')
            exit()
print('Yes')



Measured memory_bytes: 5628
#include <bits/stdc++.h>  
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N =  1000100;  
const int mod = 1e9 + 7;
#define FI first
#define SE second
typedef pair<int, int>pii;
 
int main()  
{  
//   freopen("in.txt","r",stdin);
 	int n;
 	while (~scanf("%d", &n))
 	{
 		printf("ABC%d\n", n);
 	}
   

   return 0;  
}  

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

const int MAXN = 1e5 + 10;

vector<int> grafo[MAXN];
int dp[MAXN],vis[MAXN],N,M;

int solve(int v){

	if(vis[v]) return dp[v];

	vis[v] = 1;
	int best = 0;

	for(int u : grafo[v]){
		best = max(best, solve(u) + 1 );
	}

	return dp[v] = best;

}

int main(){

	cin>>N>>M;
	for(int i = 1;i<=M;i++){
		int u,v;
		cin>>u>>v;
		grafo[u].push_back(v);
	}

	int best = 0;
	for(int i = 1;i<=N;i++) best = max(best, solve(i) );
	cout<<best<<endl;

	return 0;

}

Measured memory_bytes: 11696
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()

def prime_factorize(n):
    divisors = []
    # 27(2 * 2 * 7)の7を出すためにtemp使う
    temp = n
    for i in range(2, int(math.sqrt(n)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                # 素因数を見つけるたびにtempを割っていく
                temp //= i
            divisors.append([i, cnt])
    if temp != 1:
        divisors.append([temp, 1])
    if divisors == [] and n != 1:
        divisors.append([n, 1])

    return divisors

primli = [0] * 101
for i in range(1, N + 1):
    for j in prime_factorize(i):
        primli[j[0]] += j[1]
alta = []
for i in primli:
    if i != 0:
        alta.append(i + 1)

prim3 = 0
prim5 = 0
prim15 = 0
prim25 = 0
prim75 = 0
for i in alta:
    if i >= 75:
        prim75 += 1
    if i >= 25:
        prim25 += 1
    if i >= 15:
        prim15 += 1
    if i >= 5:
        prim5 += 1
    if i >= 3:
        prim3 += 1

ans = 0
if prim3 >= 1 and prim5 >= 2:
    # prim5 C 2
    ans += prim5 * (prim5 - 1) // 2 * (prim3 - 2)
if prim15 >= 1 and prim5 >= 1:
    ans += prim15 * (prim5 - 1)
if prim25 >= 1 and prim3 >= 1:
    ans += prim25 * (prim3 - 1)
if prim75 >= 1:
    ans += prim75
print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 3005

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

ll dp[ARRAY_MAX][ARRAY_MAX];

int main() {

	int n;
	cin >> n;

	vector<int> a(n);

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

	for (int i = 0; i <= n; i++)
	{
		dp[i][i] = 0;
	}

	for (int len = 1; len <= n; len++)
	{
		//区間の長さがlenの時
		for (int i = 0; i + len <= n; i++)
		{
			//区間の左端がiから長さlenの区間を見る
			int j = i + len;//[i,j)

			if ((n - len) % 2 == 0)
			{
				//先手
				//a[i]を取るかa[j-1]を取るか
				dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j-1]);
				
			}
			else
			{
				//後手
				//a[i]を取るかa[j-1]を取るか
				dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j-1]);
			}
		}
	}

	cout << dp[0][n] << endl;

	return 0;
}

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

int64_t f( int64_t b, int64_t n ) {
	if( n < b ) {
		return n;
	}
	else {
		return f( b, n/b ) + (n%b);
	}
}

int64_t find1( int64_t n, int64_t s ) {
	double rn = sqrt( n );

	for( int64_t b = 2; b <= rn; ++b ) {
		if( f( b, n ) == s ) {
			return b;
		}
	}

	return -1;
}

int64_t find2( int64_t n, int64_t s ) {
	int64_t result = LLONG_MAX;
	double rn = sqrt( n );

	for( int64_t p = 1; p < rn; ++p ) {
		int64_t b = (n - s) / p + 1;

		if( b > rn && b > p && f( b, n ) == s ) {
			result = min( result, b );
		}
	}

	return result == LLONG_MAX ? -1 : result;
}

int main() {
	int64_t n, s;
	cin >> n >> s;

	int64_t result = -1;

	if( n == s ) {
		result = n+1;
	}
	if( result == -1 ) {
		result = find1( n, s );
	}
	if( result == -1 ) {
		result = find2( n, s );
	}

	cout << result << endl;
}


Measured memory_bytes: 256
/*--------------------------------
  Author: The Ace Bee
  Blog: www.cnblogs.com/zsbzsb
  This code is made by The Ace Bee
--------------------------------*/
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#define rg register
using namespace std;
template < typename T > inline void read(T& s) {
	s = 0; int f = 0; char c = getchar();
	while (!isdigit(c)) f |= (c == '-'), c = getchar();
	while (isdigit(c)) s = s * 10 + (c ^ 48), c = getchar();
	s = f ? -s : s;
}

const int p = 1000000007;
const int _ = 500010;

int n, m, a, b, fac[_], inv[_];
inline void pre() {
	fac[0] = inv[0] = inv[1] = 1;
	for (rg int i = 1; i < _; ++i) fac[i] = 1ll * i * fac[i - 1] % p;
	for (rg int i = 2; i < _; ++i) inv[i] = 1ll * (p - p / i) * inv[p % i] % p;
	for (rg int i = 1; i < _; ++i) inv[i] = 1ll * inv[i - 1] * inv[i] % p;
}

inline int C(int n, int m) { return 1ll * fac[n] * inv[n - m] % p * inv[m] % p; }

inline int calc(int i1, int j1, int i2, int j2) { return C(i2 - i1 + j2 - j1, i2 - i1); }

int main() {
	pre();
	read(n), read(m), read(a), read(b);
	
	int res = 0;
	for (rg int i = 1; i <= n - a; ++i)
		res = (res + 1ll * calc(1, 1, i, b) * calc(i, b + 1, n, m) % p) % p;
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 4096
n = int(input())
S = {}

for _ in range(n):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1

m = max(S.values())
A = []
for k, v in S.items():
    if v == m:
        A.append(k)

for a in sorted(A):
    print(a)

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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  string s;
  cin >> s;
  string ans;
  rep(i,s.size())
  {
    if(i%2==0) ans+=s[i];
  }
  print(ans);

  return 0;
}

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


using namespace std;

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

    int date =0;
    int ans =0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A' || s[i]=='T' || s[i]=='C' || s[i]=='G'){
                date++;
                ans = max(date,ans);
        }else date=0;
    } 

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>

int main() {
	int w, h, n, b[100][100] = {};
	std::cin >> w >> h >> n;
	for (int i = 0;i < n;i++) {
		int x, y, a;
		std::cin >> x >> y >> a;
		if (a == 1) {
			for (int j = 0;j < h;j++) {
				for (int k = 0;k < x;k++) {
					b[k][j] = 1;
				}
			}
		}
		if (a == 2) {
			for (int j = 0;j < h;j++) {
				for (int k = x;k < w;k++) {
					b[k][j] = 1;
				}
			}
		}
		if (a == 3) {
			for (int j = y-1;j >= 0;j--) {
				for (int k = 0;k < w;k++) {
					b[k][j] = 1;
				}
			}
		}
		if (a == 4) {
			for (int j = y;j < h;j++) {
				for (int k = 0;k < w;k++) {
					b[k][j] = 1;
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (b[j][i] == 0) {
				ans += 1;
			}
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
import math

a, b, C = map(float, input().split())
S =  0.5 * a * b * math.sin(C * math.pi / 180)
L = a + b + (a ** 2 + b ** 2 - 2 * a * b * math.cos(C * math.pi / 180)) ** 0.5
h = 2 * S / a

print("%f\n%f\n%f" % (S, L, h))


Measured memory_bytes: 5700
use std::io::*;
use std::str::FromStr;
use std::process;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u32 = read();
    let Y: u32 = read();

    for x in 0..(n+1) {
        for y in (0..(n+1-x)).rev() {
            let z = n - x - y;
            let v = 10000 * x + 5000 * y + 1000 * z;
            if v == Y {
                println!("{} {} {}", x, y, z);
                process::exit(0);
            } else if v < Y {
                break
            }
        }
        if x * 10000 > Y {
            break
        }
    }
    println!("{} {} {}", -1, -1, -1);
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main(){
    int n, x, l, d = 0, cnt = 1;
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> l;
        if(d + l <= x){
            d += l;
            cnt++;
        } else break;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
h=[int(x) for x in input().split()]


score=0
buf=0

for i in range(0,n-1):
    tmp=h[i]
    if(tmp >= h[i+1]):
        buf+=1
        if buf > score:
            score = buf
    else:
        buf=0

print(score)
    


Measured memory_bytes: 14224
program main
implicit none
integer :: yyyy, mm
character(len=10) :: yyyymmdd

read(*,'(a)',advance='no') yyyymmdd

read(yyyymmdd(1:4),*) yyyy
read(yyyymmdd(6:7),*) mm
if (yyyy.lt.2019) then
write(*,*) 'Heisei'
else if (mm .lt.5)then
write(*,*) 'Heisei'
else
write(*,*) 'TBD'
end if



end program main


Measured memory_bytes: 640
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, K;
    read(N, K);

    vector<i64> h(N);
    rep(i, N) read(h[i]);

    sort(all(h));

    i64 ans = LINF;
    rep(i, N-K+1) {
        chmin(ans, h[i+K-1] - h[i]);
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 1024
def main():
    n = int(input())
    # a, b, c, d = map(int, input().split())
    # l = list(map(int, input().split()))
    # s = input()
    print(((10**n - 9**n) * 2 % (10**9 + 7) - (10**n-8**n) %
           (10**9 + 7)) % (10**9 + 7))


if __name__ == '__main__':
    main()


Measured memory_bytes: 85848
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();
		int tap = 0;
		int socket = 1;

		while(socket < B) {
			socket = socket + A - 1;
			tap ++;
		}

		System.out.println(tap);

	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+10;
 
 
 
int main(){
	int N;
	cin>>N;
	ll s[MAX];
	rep(i,N)cin>>s[i];
	
	ll ans=0;
	
	rep1(d,N-2){
		ll pa=0;
		int l=0,r=N-1;
		if((N-1)%d){
			while(r>d){
				pa=pa+s[l]+s[r];
				ans=max(ans,pa);
				l+=d;
				r-=d;
			}
		}
		else{
			while(l<r){
				pa=pa+s[l]+s[r];
				ans=max(ans,pa);
				l+=d;
				r-=d;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
f=input; n=int(f()); s=list(f())
d={chr(97+i):[0]*(n+1) for i in range(26)}
def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s
def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i
for i in range(n): badd(s[i],i+1,1)
for i in range(int(f())):
  a,b,c=f().split(); b=int(b)-1
  if a>'1': print(sum(1 for k in d.keys() if bsum(k,int(c))-bsum(k,b)))
  else: badd(s[b],b+1,-1); s[b]=c; badd(c,b+1,1)

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

const ll INF = 1001001001001001LL;

ll p[20], c[20];
ll dp[20][150010];

int main() {
   // 初期化:
   ll D, G; cin >> D >> G;
   G /= 100;

   // 入力
   rep (i, D) {
      cin >> p[i] >> c[i];
      c[i] /= 100;
   }

   // DPテーブル初期化
   fill(dp[0], dp[20], INF);
   dp[0][0] = 0;

   // DP
   rep (i, D) {
      for (ll j = 0; j <= p[i]; j++) {
         ll is_comp = (j == p[i] ? c[i] : 0);

         ll point = j*(i+1) + is_comp;
         for (ll k = 0; k <= G; k++) {
            ll nk = min(G, k + point);
            chmin(dp[i+1][nk], dp[i][k]+j);
         }
      }
   }

   cout << dp[D][G] << endl;

   return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    string s; cin >> s;
    int t = 0;
    for (char c : s) {
        if (t == 0 && c == 'C') t++;
        if (t == 1 && c == 'F') t++;
    }
    cout << (t == 2 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

signed main() {
  int A, B;
  cin >> A >> B;
  int ans = max({A + B, A - B, A * B});
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
ll K,N,A,B,C;
cin >> K >> N;
vector<ll> vector(N);
for(ll i=0 ; i<N ; i++){
  cin >> vector[i];
}
A=vector[N-1]-vector[0];
for(ll i=1 ; i<N; i++){
  A=min(A,(K-vector[i]+vector[i-1]));
}
cout << A << endl;
}


Measured memory_bytes: 1792
n = int(input())
cities = set()
d = dict()
for i in range(n):
    s, p = input().split()
    cities.add(s)
    d.setdefault(s, [])
    d[s].append((i+1, int(p)))
cities = list(cities)
cities.sort()
for c in cities:
    l = d[c]
    l.sort(key=lambda i: -i[1])
    for i in l:
        print(i[0])


Measured memory_bytes: 3064
s = input()
t = input()

ls, lt = len(s), len(t)

dp = [[0]*(lt+1) for _ in range(ls+1)]
for i in range(1, ls+1):
    for j in range(1, lt+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1)
        dp[i][j] = max(dp[i][j], dp[i][j-1])
        dp[i][j] = max(dp[i][j], dp[i-1][j])

ans = ''
while ls > 0 and lt > 0:
    if dp[ls][lt] == dp[ls-1][lt]:
        ls -= 1
    elif dp[ls][lt] == dp[ls][lt-1]:
        lt -= 1
    else:
        ans = t[lt-1] + ans
        ls -= 1
        lt -= 1

print(ans)


Measured memory_bytes: 114652
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b + c || b == a + c || c == a + b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v;
    map<int,int> m;
    int f;
    for(int i=0;i<n;i++)
    {
        cin>>f;
        v.push_back(f);
    }
    for(int i=0;i<n;i++)
    {
        f=v[i];
        if(m.count(f))
        {
            auto itr=m.find(f);
            itr->second++;
        }
        else
        {
            m.insert(pair<int,int>(f,1));
        }
    }
    long long int sum=0,rep;
    for(auto itr1=m.begin();itr1!=m.end();itr1++)
    {
        rep=itr1->second;
        sum+= rep*(rep-1)/2;
    }
    
    long long int ans;
    for(int i=0;i<n;i++)
    {
        auto itr=m.find(v[i]);
        int d=itr->second;
        ans=sum-(d*(d-1)/2)+((d-1)*(d-2)/2);
        cout<<ans<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 8308