akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
  long N;
  scanf("%ld", &N);
  for(int h = 1; h < 3501; h++) for(int n = 1; n < 3501; n++){
    long u1 = N * (n + h) - 4 * h * n;
    long u2 = -N * h * n;
    if(u1 != 0){
      double w = u2 / u1;
      if(w >= 0 && u2 % u1 == 0){
        printf("%d %d %d\n", n, h, (int)w);
        return 0;
      }
    }
  }
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static boolean[] isHamming = new boolean[1000001];
	static int n, m;
	public static void main(String[] args) {
		generateHammingNumber();
		while(read()){
			solve();
		}
	}
	
	static void generateHammingNumber(){
		Arrays.fill(isHamming, false);
		isHamming[1] = true;
		for(int i = 0; i < isHamming.length; i++){
			if( isHamming[i] ){
				if( i*2 <= isHamming.length-1 ) isHamming[i*2] = true;
				if( i*3 <= isHamming.length-1 ) isHamming[i*3] = true;
				if( i*5 <= isHamming.length-1 ) isHamming[i*5] = true;
			}
		}
	}
	
	static boolean read(){
		m = sc.nextInt();
		if( m == 0 )return false;
		n = sc.nextInt();
		return true;
	}
	
	static void solve(){
		int res = 0;
		for(int i = m; i <= n; i++){
			if( isHamming[i] )res++;
		}
		System.out.println(res);
	}

}

Measured memory_bytes: 22000
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
typedef long long int ll;


int main() {
	int a, b, x;
	cin >> a >> b >> x;
	YESNO(a <= x && x <= a+b);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <time.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
	ll s;
	if(k > 1){
		s = k*facctorialMethod(k-1);
	} else {
		s = 1;
	}
	return s;
}
vl primes(ll n){ //1e6くらいまでしか使えん
	vl x(n);
	REP(i, sqrt(n)+2){
		x[i] = 0;
	}
	for(ll i = 2; i < sqrt(n) + 2; i++){
		while(n % i == 0){
			n /= i;
			x[i-1] += 1;
		}
	}
	if(n > 1){
		x[n-1] += 1;
	}
	return x;
}
const ll mod = 1000000007;
const ll INF = 1e9;

// 変数定義start(vectorはresizeしようね)
ll N;
vl A;
// 変数定義end

void solve(){
	cin >> N;
	A.resize(N);
	REP(i, N){
		cin >> A[i];
	}
	vl B(N);
	REP(i, N){
		B[i] = i+1;
	}
	sort2vectors(A, B);
	REP(i, N){
		cout << B[i] << " ";
	}
}

int main(){

    //clock_t start = clock();

    cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve(); clock_t end = clock();

    //const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    //printf("time %lf[ms]\n", time);
}


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

int main () {
 int a,b,c;
 int count = 0;

 cin >> a >> b >> c;

 for  (int i = a;i <= b;i++) {
  if (c % i == 0) {
   count++;
  }
 }
 cout << count << endl;
 return 0;
}

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

const int MOD = 1e9 + 7;

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

long long pow_mod(long long x, long long n) {
    long long res = 1;
    while (n) {
        if (n & 1) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;  cin >> N;
    using P = pair<long long, long long>;
    map<P, long long> mp;
    vector<long long> a(N), b(N);
    int cnt_zero = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i] >> b[i];
        long long g = gcd(a[i], b[i]);
        if (a[i] == 0 && b[i] == 0) {
            ++cnt_zero;
            continue;
        }
        a[i] /= g;  b[i] /= g;
        ++mp[P(a[i], b[i])];
    }
    // DUMP(mp);

    long long ans = 1;
    for (auto e : mp) {
        // DUMP(e);
        if (mp[P(e.first.first, e.first.second)] == 0) continue;
        if (mp[P(-e.first.second, e.first.first)] != 0) {
            ans = ans * ((pow_mod(2, mp[P(e.first.first, e.first.second)]) + pow_mod(2, mp[P(-e.first.second, e.first.first)]) - 1) % MOD ) % MOD;
            mp[P(-e.first.second, e.first.first)] = 0;
        }
        else if (mp[P(e.first.second, -e.first.first)] != 0) {
            ans = ans * ((pow_mod(2, mp[P(e.first.first, e.first.second)]) + pow_mod(2, mp[P(e.first.second, -e.first.first)]) - 1) % MOD ) % MOD;
            mp[P(e.first.second, -e.first.first)] = 0;
        }
        else {
            ans = ans * pow_mod(2, mp[P(e.first.first, e.first.second)]) % MOD;
        }
    }

    ans -= 1;
    if (cnt_zero) ans += cnt_zero;
    while (ans < 0) ans += MOD;
    cout << ans << endl;
}


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

int main(){
	int a, b;
	cin >> a >> b;
	if (a > b){
		cout << "a > b" << endl;
	}
	else if (a < b){
		cout << "a < b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        char[] s = Console.ReadLine().ToCharArray();

        if (s[0] != 'A')
        {
            Console.WriteLine("WA");
            return;
        }

        int count = 0;
        int index = 2;
        for (int i = 2; i < s.Length - 1; i++)
        {
            if (s[i] == 'C')
            {
                count++;
                index = i;
            }
        }
        if (count != 1)
        {
            Console.WriteLine("WA");
            return;
        }

        for (int i = 1; i < s.Length; i++)
        {
            if (index == i)
                continue;
            if (Char.IsUpper(s[i]))
            {
                Console.WriteLine("WA");
                return;
            }
        }
        Console.WriteLine("AC");
    }
}

Measured memory_bytes: 13140
// Problem : D - Chat in a Circle
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

#define ll       long long int
#define ull      unsigned long long int
#define pb       push_back
#define vi       vector<int>
#define vb       vector<bool>
#define vll      vector<long long int>
#define pi       pair<int,int>
#define mod      10000007
#define all(x)   (x).begin(), (x).end()



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int t=1;
	//cin>>t;
	
	while(t--)
	{
		int n;
		cin>>n;
		
		vi v(n);
		
		for(int i=0;i<n;i++)
			cin>>v[i];
		
		
		sort(v.begin(),v.end(),greater<ll>());
		
		
		ll s=0;
		
		for(int i=1;i<n;i++)
			s+=v[i/2];
		
		cout<<s<<"\n";
	}
	
   	return 0;
}



Measured memory_bytes: 4012
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    print('x'*len(input()))

if __name__ == '__main__':
    main()

Measured memory_bytes: 66284
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int a[1010];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  int ans=-1;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int t=a[i]*a[j];
      int f=0;
      while(t/10){
	if(t%10==(t/10)%10+1)t/=10;
	else {
	  f=1;
	  break;
	}
      }
      if(f)continue;
      ans=max(ans,a[i]*a[j]);
    }
  }
  cout<<ans<<endl;
  return 0;
}



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

int main() {
    int64_t N, X, M;
    cin >> N >> X >> M;

    vector<int64_t> appear(M + 1, -1);
    vector<int64_t> A;
    int64_t curr_value = X;
    for (int64_t i = 0; ; i++) {
        A.push_back(curr_value);
        if (appear[curr_value] != -1) {
            break;
        }
        appear[curr_value] = i;
        curr_value = curr_value * curr_value % M;
    }

    int64_t loop_start_index = appear[A.back()];
    int64_t loop_end_index = A.size() - 1;
    int64_t loop_period = loop_end_index - loop_start_index;
    int64_t loop_num = (N - loop_start_index) / loop_period;
    int64_t ans = 0;

    //ループまで
    for (int64_t i = 0; i < loop_start_index; i++) {
        (ans += A[i]);
    }

    //ループ中
    int64_t loop_sum = 0;
    for (int64_t i = loop_start_index; i < loop_end_index; i++) {
        loop_sum += A[i];
    }
    ans += loop_sum * loop_num;

    //ループ後
    int64_t index = loop_start_index + loop_period * loop_num;
    for (int64_t i = index; i < N; i++) {
        (ans += A[loop_start_index + i - index]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 4600
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct Point {
  int x;
  int y;
  int dir;
  int cost;
  int l;
  int r;
  Point() {;}
  Point(int x, int y, int dir, int cost, int l, int r) :
    x(x), y(y), dir(dir), cost(cost), l(l), r(r) {;}
  bool operator<(const Point &rhs) const {
    return cost > rhs.cost;
  }
};

int h, w, k;
char field[110][110];
bool visit[110][110][4][11][11];
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

bool OK(int x, int y) {
  if (x < 0 || x >= w || y < 0 || y >= h || field[y][x] == '#') { return false; }
  return true;
}

int main() {
  while (scanf("%d %d %d", &h, &w, &k) > 0) {
    MEMSET(visit, false);
    int sx, sy;
    REP(y, h) {
      scanf("%s", field[y]);
      REP(x, w) {
        if (field[y][x] == 'S') { sx = x; sy = y; }
      }
    }
    priority_queue<Point> que;
    if (OK(sx, sy + 1)) {
      que.push(Point(sx, sy + 1, 1, 0, k, k));
    }
    REP(i, 11) REP(j, 11) { visit[sy][sx][3][i][j] = true; }
    while (!que.empty()) {
      Point p = que.top();
      que.pop();
      if (visit[p.y][p.x][p.dir][p.l][p.r]) { continue; }
      visit[p.y][p.x][p.dir][p.l][p.r] = true;
      if (field[p.y][p.x] == 'G') {
        printf("%d\n", p.cost);
        goto next;
      }
      do {
        int nx = p.x + dx[p.dir];
        int ny = p.y + dy[p.dir];
        if (!OK(nx, ny)) { continue; }
        que.push(Point(nx, ny, p.dir, p.cost, p.l, p.r));
      } while (false);
      if (field[p.y][p.x] != 'S') {
        do {
          int ndir = p.dir ^ 1;
          int nx = p.x + dx[ndir];
          int ny = p.y + dy[ndir];
          if (p.l == 0) { continue; }
          if (!OK(nx, ny)) { continue; }
          que.push(Point(nx, ny, ndir, p.cost + 1, p.l - 1, p.r));
        } while (false);
        do {
          int ndir = p.dir ^ 3;
          int nx = p.x + dx[ndir];
          int ny = p.y + dy[ndir];
          if (p.r == 0) { continue; }
          if (!OK(nx, ny)) { continue; }
          que.push(Point(nx, ny, ndir, p.cost + 1, p.l, p.r - 1));
        } while (false);
      }
    }
    puts("-1");
next:;
  }
}

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

int main() {
  int N;
  cin >> N;
  int count = 30;
  
  for(int i = 0; i < N; i++) {
    int n;
    cin >> n;
    int c = 0;
	while(n % 2 == 0) {
      n /= 2;
  	  c++;
    }
    count = min(count, c);
  }
  cout << count << endl;
}


Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n,l;
	cin>>n>>l;
	int a[n+1];
	int m=abs(l);
	int sum=0;
	for(int x=1;x<=n;x++){
		a[x]=l+x-1;
		sum+=a[x];
		//cout<<sum<<" ";
		if(abs(a[x])<abs(m)){
			m=a[x];
		}
	//	cout<<m<<" ";
	}
	cout<<sum-m;







	
	
return 0;	
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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 int MOD = 1000000007;

// 噂の嘘解法を投げてみる
int main() {
    int n;
    cin >> n;
    int a;
    cin >> a;
    int b;
    REP(i, n - 1) {
        cin >> b;
        a ^= b;
    }
    cout << (a == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
x1,y1,x2,y2  = map(int, input().split())
x3=x2-(y2-y1)
y3=y2+(x2-x1)
x4=x1-(y2-y1)
y4=y1+(x2-x1)
print("{} {} {} {}".format(x3,y3,x4,y4))


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
int main(){
  int x;
  cin >> x;
  int lank=x/200;
  cout << 10-lank << endl;
}

Measured memory_bytes: 3632
a=[]
for i in range(3):
  c=list(map(int,input().split()))
  a.append(c)
m=[[0,0,0] for i in range(3)]
n=int(input())
b=[]
for i in range(n):
  b.append(int(input()))

for i in range(3):
  for j in range(3):
    if a[i][j] in b:
      m[i][j]=1

cnt0=0
cnt1=0
cnt2=0
cnt3=0
cnt4=0
cnt5=0
cnt6=0
cnt7=0
ans="No"

for i in range(3):
  if m[0][i]==1:
    cnt0+=1
  if m[1][i]==1:
    cnt1+=1
  if m[2][i]==1:
    cnt2+=1
  if m[i][0]==1:
    cnt3+=1
  if m[i][1]==1:
    cnt4+=1
  if m[i][2]==1:
    cnt5+=1
  if m[i][i]==1:
    cnt6+=1
  if m[i][2-i]==1:
    cnt7+=1

if cnt0==3 or cnt1==3 or cnt2==3 or cnt3==3:
  ans="Yes"
if cnt4==3 or cnt5==3 or cnt6==3 or cnt7==3:
  ans="Yes"  
print(ans)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if (a>=10 || b>=10)
	{
		cout<<-1<<endl;
		return 0;
	}
	else
	{
		cout<<a*b<<endl;
		return 0;
	}
 } 

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define MAX 45
int A[MAX];
int F(int n){
    int i;

    A[1] = 1;     
    A[2] = 2;

    for (i = 3; i <= n; i++)
        A[i] = A[i - 1] + A[i - 2];

    return (A[n]);
}

int main()
{
    int n;
    
    scanf("%d", &n);

    if(n > MAX-1) { 
        exit(8);
    }
    else{
    printf("%d\n", F(n));
}
    return 0;
}



Measured memory_bytes: 2112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));
        String[] data = br.readLine().split(" ");
        int a = Integer.parseInt(data[0]);
        int b = Integer.parseInt(data[1]);
        System.out
            .println((a / b) + " " + (a % b) + " "
                + String.format("%.5f", ((double) a / (double) b)));
    }
}

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

int a[100005], b[100005];

int main()
{
	int n, p;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &p);
		if (i & 1)
			a[p]++;
		else
			b[p]++;
	}
	int mx = 0, mx_freq = 0;
	int mx_freq2 = 0;
	for (int i = 1; i < 1e5 + 1; i++)
	{
		if (a[i] >= mx_freq)
		{
			mx = i;
			mx_freq = a[i];
		}
	}
	for (int i = 1; i < 1e5 + 1; i++)
		if (i != mx)
			mx_freq2 = max(mx_freq2, a[i]);

	int m = 0, m_freq = 0;
	int m_freq2 = 0;
	for (int i = 1; i < 1e5 + 1; i++)
	{
		if (b[i] >= m_freq)
		{
			m = i;
			m_freq = b[i];
		}
	}
	for (int i = 1; i < 1e5 + 1; i++)
		if (i != m)
			m_freq2 = max(m_freq2, b[i]);
	if (mx != m)
		printf("%d", n - m_freq - mx_freq);
	else
		printf("%d", n - max(mx_freq + m_freq2, mx_freq2 + m_freq));
}

Measured memory_bytes: 4580
#include <stdio.h>

int main(void) {
  int i, j, k, a, b, c, d, e, f, ansa, ansb = 0;
  double now = 0.0;
  scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
  ansa = a * 100;
  bool bo[31];
  for(i = 0; i < 31; ++i) bo[i] = false;
  bo[0] = true;
  for(i = 0; i * a < 31; ++i) bo[a * i] = true;
  for(i = 0; i < 31; ++i) if(bo[i] && i + b < 31) bo[i + b] = true;
  for(j = 1; j < f / 100; ++j) if(bo[j]) {
    bool dp[e * j + 1];
    for(i = 0; i <= e * j; ++i) dp[i] = false;
    dp[0] = true;
    for(i = 0; i * c <= e * j; ++i) dp[c * i] = true;
    for(i = 0; i <= j * e; ++i) if(dp[i] && i + d <= j * e) dp[i + d] = true;
    int tmp = 0;
    for(i = 0; i <= e * j; ++i) if(j * 100 + i <= f && dp[i]) tmp = i;
    if(now < (double)tmp / (double)j) now = (double)tmp / (double)j, ansa = j * 100 + tmp, ansb = tmp;
  }
  printf("%d %d", ansa, ansb);
  return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  int days = 0 ;
  
  for (int i = 0; i < N; i++) {
      int take_days = 0;
      cin >> take_days;
      days += take_days;
    
  }
  if(days > N){std::cout << "-1" << std::endl;}
  
  else{
      std::cout << N - days << std::endl;
  }
  
}



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

int main() {
	string S;
	string T;
	string U;
	int A;
	int B;
	cin>>S>>T;
	cin>>A>>B;
	cin>>U;
	if(S==U&&T!=U)
	{
		cout<< A-1<<" "<< B<<endl;
	}
	else if(T==U&&S!=U)
	{
		cout<<A <<" "<< B-1 <<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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 ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ 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 , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }

fn main() {
    input! {
        n: usize,
        h: [u64;n],
    }

    let mut v = vec![];
    v.push(h[0]);

    for i in 1..n {
        if h[i] >= *v.last().unwrap() {
            v.push(h[i]);
        }
    }

    println!("{}", v.len());
}


Measured memory_bytes: 4352
M,D = map(int,input().split())
count = 0
for i in range(1,M+1):
    for j in range(1,D+1):
        if len(str(j)) == 1 or int(str(j)[0]) <= 1 or int(str(j)[1]) <= 1:
            continue
        if int(str(j)[1])*int(str(j)[0]) == i:
            count += 1
print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    string  a;
    cin>>a;
   if(a[0]==a[1]&&a[1]==a[2])
    cout<<"Yes";

     else if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3])
    cout<<"Yes";

    else if(a[1]==a[2]&&a[2]==a[3])
    cout<<"Yes";

else
 cout<<"No";






    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

    int a,b,c;

    scanf("%d %d %d", &a, &b, &c); 

    if (a<b) {
        if (b<c)
        printf("%d %d %d\n", a,b,c);
        else if (b>c) {
		if (a>c)
        printf("%d %d %d\n", c,a,b);
		else
		printf("%d %d %d\n", a,c,b);
}
    } else if (a>b) {
        if (a<c) 
        printf("%d %d %d\n", b,a,c);
        else if (a>c) {
		if (b<c) 
        printf("%d %d %d\n", b,c,a);
		else
		printf("%d %d %d\n", c,b,a);
}
    } else {
        if(a<b) 
        printf("%d %d %d\n", c,a,b);
        else if (a>c)
        printf("%d %d %d\n", c,a,b);
    }
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int n, a, b;
	cin >> n >> a >> b;
	a--; b--;
	int d[n][n] = {};
	int ans[n] = {};
	rep(i, n) {
		REP(j, i+1, n) {
			d[i][j] = j - i;
			d[j][i] = j - i;
			if(i <= a && b <= j) {
				chmin(d[i][j], d[i][j] -= (b - a - 1));
				d[j][i] -= (b - a - 1);
			}
			// chmin(d[i][j], d[i][a] + 1 + d[b][j]);
			// ans[d[i][j]]++;
		}
	}
	rep(i, n) {
		REP(j, i+1, n) {
			chmin(d[i][j], d[i][a] + 1 + d[b][j]);
			ans[d[i][j]]++;
		}
	} 

	REP(i, 1, n) {
		cout << ans[i] << endl;
	}
	// rep(i, n) {
	// 	rep(j, n) cout << d[i][j] << " ";
	// 	cout << endl;
	// }
	return 0;
}

Measured memory_bytes: 31488
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]
ans = []
for i,h in enumerate(H):
    ans.append([i+1, abs(T-0.006*h - A)])
ans.sort(key=lambda x:x[1])
print(ans[0][0])

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define ll long long
using namespace std;
int n,m,q;
ll s[120000];
ll t[120000];
ll x[120000];
struct node
{
    bool flag;
    ll x;
    int lidx,ridx;
};
node line[300000];
int lt;

bool cmp(node a,node b)
{
    return a.x<b.x;
}

int getl(int now)
{
    if (now==1) return -1;
    if (line[now].flag==line[now-1].flag) 
    {
        if (line[now-1].lidx!=0)
        {
            line[now].lidx=line[now-1].lidx;
        }else
        {
            line[now].lidx=getl(now-1);
        }
    }else
    {
        line[now].lidx=now-1;
    }
    return line[now].lidx;
}
int getr(int now)
{
    if (now==lt) return -1;
    if (line[now].flag==line[now+1].flag) 
    {
        if (line[now+1].ridx!=0)
        {
            line[now].ridx=line[now+1].ridx;
        }else
        {
            line[now].ridx=getr(now+1);
        }
    }else
    {
        line[now].ridx=now+1;
    }
    return line[now].ridx;
}


int tfind(ll x)
{
    if (x<=line[1].x) return 1;
    if (x>=line[lt].x) return lt;
    int l=1,r=lt;
    int mid;
    while (l<=r)
    {
        mid=l+((r-l)>>1);
        if (line[mid].x<=x && x<line[mid+1].x)
            return mid;
        if (line[mid].x<=x)
            l=mid;
        else r=mid;
    }
    return mid;
}


int main()
{
    ll INF=100000;
    INF=INF*INF;
    scanf("%d%d%d",&n,&m,&q);
    for (int i=1; i<=n; ++i)
    {
        scanf("%lld",&s[i]);
        line[i].flag=0;
        line[i].x=s[i];
    }
    for (int i=1; i<=m; ++i)
    {
        scanf("%lld",&t[i]);
        line[n+i].flag=1;
        line[n+i].x=t[i];
    }
    for (int i=1; i<=q; ++i)
        scanf("%lld",&x[i]);
    lt=n+m;
    sort(line+1,line+1+lt,cmp);
    for (int i=1; i<=lt; ++i)
    {
        if (line[i].lidx==0)
            line[i].lidx=getl(i);
        if (line[i].ridx==0)
            line[i].ridx=getr(i);
    }
//    for (int i=1; i<=lt; ++i)
 //       cout<<line[i].flag<<' '<<line[i].x<<' '<<line[i].lidx<<' '<<line[i].ridx<<endl;
    for (int i=1; i<=q; ++i)
    {
        ll ansl=INF;
        ll ansr=INF;
        ll minL=INF;
        int idx=tfind(x[i]);
//        cout<<idx<<endl;
        if (idx>=1 && idx<=lt)
        {
            ansl=0;
            ansl=abs(x[i]-line[idx].x);
            if (line[idx].lidx!=-1)
                minL=min(minL,abs(line[idx].x-line[line[idx].lidx].x));
            if (line[idx].ridx!=-1)
                minL=min(minL,abs(line[idx].x-line[line[idx].ridx].x));
            ansl+=minL;
        }
        if (idx>=1 && idx<=lt)
        {
            ansr=0;
            minL=INF;
            idx+=1;
            ansr=abs(x[i]-line[idx].x);
            if (line[idx].lidx!=-1)
                minL=min(minL,abs(line[idx].x-line[line[idx].lidx].x));
            if (line[idx].ridx!=-1)
                minL=min(minL,abs(line[idx].x-line[line[idx].ridx].x));
            ansr+=minL;
        }
        ll ans=min(ansl,ansr);
        printf("%lld\n",ans);
    }

    return 0;
}



Measured memory_bytes: 12416
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		String message = ":(";
		if(a <= 8 && b <= 8) {
			message = "Yay!";
		}
		System.out.println(message);
	}
}

Measured memory_bytes: 22996
N,K=map(int,input().split())
a=list(map(int,input().split()))

M1=0
for i in range(N):
    if a[i]>=0:
        M1+=a[i]
        
s=0
for i in range(K):
    s+=max(0,a[i])
m1=s
for i in range(N-K):
    s=s+max(0,a[K+i])-max(0,a[i])
    if m1>s:
        m1=s

s=0

for i in range(K):
    s+=min(0,a[i])
m2=s
for i in range(N-K):
    s=s+min(0,a[K+i])-min(0,a[i])
    if m2<s:
        m2=s
print(max(M1-m1,M1+m2))

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

const long long N = 1e3 + 17;
ll cnt, ans, lnt, sum, n, l1, x, y, a[N], mx, b[N][N], m;
pair<ll,ll>pr[N];
vector<ll>v,v2,v3;
map<ll,ll>mp;
bool used[N], t1, t2;
vector<string>sv;

int main()
{
    cin >> n;
    for(ll i = 0; i < n; i ++)
    {
        cin >> a[i];
        mx = max(a[i], mx);
    }
    for(ll i = 0; i < n; i ++)
    {
        if(a[i] == mx)
        {
            a[i] /= 2;
            break;
        }
    }
    for(ll i = 0; i < n; i ++)
    {
        sum += a[i];
    }
    cout << sum;
}


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

int main(){
	int a,b,c,d;cin >> a >> b >> c >> d;
  	if((abs(a-b)<=d && abs(b-c)<=d) || abs(a-c)<=d){
    	cout << "Yes";
    }else{
    	cout << "No";
    }
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 10000000000;
int main() {
	int N; cin >> N;
	int decrease=0;
	string s, t; cin >> s >> t;
	for (int i = N; i >0; i--) {
		bool flg = true;
		for (int j = 0; j <i; j++) {
			if (t[j] != s[N - 1 - (i - 1) + j]) {
				flg = false;
				break;
			}
		}
		if (flg) {
          decrease = i;
          break; 
        }
	}
	cout << 2 * N - decrease << endl;
    //cout<<decrease<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
int main(void) {
	int N, T;
	std::cin >> N >> T;

	std::vector<int> costs;

	int time = 0;
	int cost = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> cost >> time;
		if (time <= T) {
			costs.push_back(cost);
		}
	}
	if (costs.size() == 0) {
		std::cout << "TLE";
	} else {
		std::sort(costs.begin(), costs.end());
		std::cout << costs[0];
	}
	return 0;
}

Measured memory_bytes: 256
A , B , K = map(int,input().split())
for i in range(K):
	if i % 2 == 0:
		if A % 2 == 1:
			A-=1
		a = A / 2
		A = A / 2
		B+=a
	else:
		if B % 2 == 1:
			B-=1
		b = B / 2
		B = B / 2
		A+=b
print(int(A),int(B))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n+1), b(n);
    rep(i, 0, n+1) cin >> a[i];
    rep(i, 0, n) cin >> b[i];

    ll ans = 0;
    rep(i, 0, n) {
       ll x = min(b[i], a[i]);
       ans += x, a[i] -= x, b[i] -= x;
       ll y = min(b[i], a[i+1]);
       ans += y, a[i+1] -= y;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

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

	double n;
	cin >> n;
	printf("%.12lf\n", (n / 3) * (n / 3) * (n / 3));

	return 0;
}


Measured memory_bytes: 256
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 (a < b) { 
        System.out.println("a < b");
    } else if (a > b) {
        System.out.println("a > b");
    } else {
        System.out.println("a == b");
    }
 }
}


Measured memory_bytes: 26248
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

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

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

  cout << min(a*n, b) << endl;
  return 0;
}

Measured memory_bytes: 256
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int a, b, c;

int main() {
  init_ios();
  cin >> a >> b >> c;
  cout<<min(c, b/a)<<"\n";
}

Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);++i) 
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
using namespace std;
using ll=long long;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int N, M;
typedef pair<int, int> pint;

vector<pint> A;
bool cmp(pint a, pint b){return a.second < b.second;}

int main(){
  cin>>N>>M;
  A.resize(M);
  REP(i,M) cin>>A[i].first>>A[i].second;
  sort(ALL(A), cmp);
  int ans=0;
  int endtime=0;
  REP(i,M){
    if(A[i].first>=endtime){
      endtime=A[i].second;
      ++ans;
    }
  }

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define FOR(i,n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<ii> vii;

const int MX = 200005;
int n, a[MX], acu;
ll res = 0;

int main () {
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    cin >> n;
    for (int i = 0, j = 0; i < n; i++) {
        cin >> a[i];

        while (acu & a[i])
            acu ^= a[j++];

        res += (i - j + 1);
        acu ^= a[i];
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
//#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
/*#define fast ios_base::sync_with_stdio(0); cin.tie(0)*/
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
const double pi = acos(-1);
typedef long long ll;
int main()
{
	//fast;
	
	ll a,b,x;
	cin>>a>>b>>x;
	if(a<=x && b>=(x-a))
	cout<<"YES\n";
	else
	cout<<"NO\n";
}

Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <set>
#include <map>
 
#pragma GCC optimize ("-O3")
#define rep(i, initial_value, max_value) for (int i{initial_value}; i < max_value; ++i)
#define fore(i, a) for(auto &i:a)
#define each(i, c) \
  for( \
      __typeof((c).begin()) i{(c).begin()}, __typeof((c).end()) end{(c).end()}; \
      i != end; \
      ++i \
  )
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
 
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<class T>bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
 
// ===
 
void _main() {
  ll n;
  cin >> n;
 
  ll ans;
  if (n % 2 == 0) {
    ans = n / 2 - 1;
  } else {
    ans = (1 + n) / 2 - 1;
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 384
from collections import deque
import sys

n,m = map(int,input().split())

uvs = []
dic = {}

for i in range(m):

    u,v,s = map(int,input().split())
    u -= 1
    v -= 1
    uvs.append([u,v,s])

    if u not in dic:
        dic[u] = []
    if v not in dic:
        dic[v] = []

    dic[u].append([v,s])
    dic[v].append([u,s])


lis = [[0,None] for i in range(n)]

lis[0] = [0,0] #0だと+x
q = deque([0])
flag = False

while len(q) > 0:

    now = q.popleft()

    for i in dic[now]:

        np = i[0]
        nd = i[1]

        if lis[np][1] == None:
            lis[np] = [nd-lis[now][0],lis[now][1]^1]
            q.append(np)

        elif lis[np][1] != lis[now][1]:
            if lis[np][0] != nd - lis[now][0]:
                print (0)
                sys.exit()

        else:

            new = [nd-lis[now][0],lis[now][1]^1]

            if lis[np][1] == 0:
                x = (new[0] - lis[np][0]) // 2
                flag = True
                break
            else:
                x = (lis[np][0] - new[0]) // 2
                flag = True
                break
#print (lis)
if flag: #答えは 0or1

    lis2 = [None] * n
    lis2[0] = x
    q = deque([0])

    while len(q) > 0:

        now = q.popleft()
        for i in dic[now]:

            np = i[0]
            nd = i[1]

            if lis2[np] == None:
                lis2[np] = nd - lis2[now]
                q.append(np)
            elif lis2[np] != nd - lis2[now]:
                print (0)
                sys.exit()

            if min(lis2[now],lis2[np]) <= 0:
                print (0)
                sys.exit()
    #print (lis2)
    print (1)

else: #答えは多様

    m = 1
    M = float("inf")
    #print (lis)

    for i in range(n):

        if lis[i][1] == 0:
            m = max(m , -1 * lis[i][0] + 1)
        else:
            M = min(M , lis[i][0] - 1)

    #print (m,M)
    print (max(0,M-m+1))


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] tempD = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			Dictionary<int, int> d = new Dictionary<int, int>();
			for (int i = 0; i < n; i++) {
				if (d.ContainsKey(tempD[i]) == false) {
					d[tempD[i]] = 1;
				} else {
					d[tempD[i]] += 1;
				}
			}

			int m = int.Parse(Console.ReadLine());
			if (n < m) {
				Console.WriteLine("NO");
				return;
			}

			int[] t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

			for (int i = 0; i < m; i++) {
				if (d.ContainsKey(t[i]) == false) {
					Console.WriteLine("NO");
					return;
				} else if (d[t[i]] == 0) {
					Console.WriteLine("NO");
					return;
				} else {
					d[t[i]] -= 1;
				}
			}

			Console.WriteLine("YES");
		}
	}

	
}


Measured memory_bytes: 51352
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <limits.h>

int main(void){
    int i;
    char s[21];
    scanf("%s",s);
    for(i=1;i<=strlen(s);i++){
        printf("%c",s[strlen(s)-i]);
    }
    printf("\n");
    return 0;
}



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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> v(n), c(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    } 
    for(int i = 0; i < n; i++) {
        cin >> c[i];
    }

    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] > c[i]) {
            ans += v[i] - c[i];
        }
    }

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


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

int main(){
  int a,b;
  cin>>a>>b;
  if(a%3==0||b%3==0||(a+b)%3==0){
    cout<<"Possible"<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

void show_field(vvi field, int H) {
	REP(i, H) {
		REP(j, 5) {
			cout << field[i][j] << " ";
		}
		cout << endl;
	}
}

vvi fall(vvi field, int H) {
	vvi new_field(H, vi(5));
	REP(j, 5) {
		int pos = H - 1;
		for (int i = H - 1; i >= 0; i--) {
			if (field[i][j] > 0) {
				new_field[pos][j] = field[i][j];
				pos--;
			}
		}
	}
	return new_field;
}

int main() {
	int H;
	while (cin >> H, H) {
		vvi field(H, vi(5));
		REP(i, H) {
			REP(j, 5) {
				cin >> field[i][j];
			}
		}

		int score = 0;
		bool updated = true;
		while (updated) {
			updated = false;
			REP(i, H) {
				REP(j, 3) {
					int num = field[i][j];
					if (num != 0) {
						int succ = 0;
						while (j + succ != 5 && num == field[i][j + succ]) {
							succ++;
						}
						if (succ >= 3) {
							score += num*succ;
							REP(k, succ) {
								field[i][j + k] = 0;
							}
							updated = true;
						}
					}
				}
			}
			field = fall(field, H);
		}

		cout << score << endl;
	}

	return 0;
}

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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;
int n;
set<string> st;

int main(void) {
    cin >> n;
    rep(i, 0, n) {
        string s;
        cin >> s;
        st.insert(s);
    }
    

    cout << sz(st) << endl;

	return 0;
}


Measured memory_bytes: 19252
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;

ll n,m,k,a,b;
string s,t;

int main() {
  cin >> k >> a >> b;
  ll ans=0;
  if(a>b || k<a || b-a==1) ans=k+1;
  else{
    ans=a;
    rep(i,k-(a-1)){
      if(i%2==1) ans+=b-a;
      else if(i%2==0 && i==k-(a-1)-1) ans++;
    }
  }
  cout << ans << endl;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int P, Q, R; cin >> P >> Q >> R;
    vector<int> A;
    A.push_back(P);
    A.push_back(Q);
    A.push_back(R);
    sort(A.begin(), A.end());
    cout << A[0]+A[1] << endl;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

gcd' x 0 = x
gcd' x y
    | x > y     = gcd' y ( mod x y )
    | otherwise = gcd' x ( mod y x )

main = do 
    (x:y:_) <- (map read.words) <$> getLine
    putStrLn $ show(gcd' x y)

Measured memory_bytes: 3576
#include <iostream>
using namespace std;
int N;

void dfs(string s, char mx) {
    if (s.size() == N) {
        cout << s.c_str() << endl;
    } else { 
        for (char c = 'a'; c <= mx; c++) {
            dfs(s+c, ((c==mx) ? (char)(mx + 1) : mx));
        }
    }
}

int main() {
    cin >> N;
    dfs("", 'a');
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
#define double long double
#define PI 3.141592653589793
typedef long long ll;
const int MOD = 1000000007;
const int INF = LLONG_MAX;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> divisor(int n){
  vector<int> ret;
  for(int i = 1;i*i <= n;i++){
    if(n%i == 0){
      ret.push_back(i);
      if(i*i != n)ret.push_back(n/i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

int n,k;int a[110000];int dp[100][2];
signed main(){
  cin>>n>>k;rep(i,n)cin>>a[i];
  dp[0][0] = 0;rep(i,100)dp[i][1] = -1;
  rep(i,50){
    int cost1, cost0 = 0;
    rep(j,n)if(a[j]&(1LL<<(50-i-1)))cost0++;
    cost1 = n-cost0;
    cost0 *= 1LL<<(50-i-1);cost1 *= 1LL<<(50-i-1);
    //cout << i << " " << cost0 << " " << cost1 << endl;
         // cout << "sss " << i << " " << dp[i+1][1] << " " << k << " " << (1LL<<(50-i-1)) << " " << (k&(1LL<<(50-i-1))) << endl;

    if(k&(1LL<<(50-i-1)))dp[i+1][1] = dp[i][0]+cost0;
    if(dp[i][1] >= 0)dp[i+1][1] = max(dp[i+1][1], dp[i][1]+max(cost0, cost1));
    dp[i+1][0] = dp[i][0]+(k&(1LL<<(50-i-1)) ? cost1 : cost0);
  }
    //rep(i,51)cout << dp[i][0] << (i == 50 ? "\n" : " ");
    //rep(i,51)cout << dp[i][1] << (i == 50 ? "\n" : " ");
  cout << max(dp[50][0], dp[50][1]) << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  int k = -1;
  for (int i = 2; i < n + 2; ++i) if (i * (i - 1) >> 1 == n) k = i;
  if (k == -1) return cout << "No" << '\n', 0;
  cout << "Yes" << '\n';
  cout << k << '\n';
  VV<> res(k);
  int p = 0, q = 1;
  for (int i = 0; i < n; ++i) {
    res[p].push_back(i + 1);
    res[q].push_back(i + 1);
    if (p == k - 2) break;
    if (q != k - 1) ++q;
    else ++p, q = p + 1;
  }
  for (int i = 0; i < k; ++i) {
    cout << k - 1 << ' ';
    for (int j = 0; j < k - 1; ++j) cout << res[i][j] << (j != k - 2 ? ' ' : '\n');
  }
}

Measured memory_bytes: 2304