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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

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

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

template<class T>
bool chmax(T &a, initializer_list<T> l)
{
	return chmax(a, *max_element(l.begin(), l.end()));
}

template<class T>
bool chmin(T &a, initializer_list<T> l)
{
	return chmin(a, *min_element(l.begin(), l.end));
}

ll dp[10010];

int main(int argc, char **argv)
{
	ll H, N; cin >> H >> N;
	vector<ll> A(N), B(N);
	REP(i, N) cin >> A[i] >> B[i];

	REP(j, 10010) dp[j] = INF;
	dp[0] = 0;

	REP(n, N)
	{
		REP(h, H+1)
		{
			chmin(dp[min(h+A[n], H)], dp[h] + B[n]);
		}
	}

	std::cout << dp[H] << std::endl;
}

Measured memory_bytes: 384
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::min;

#[fastout]
fn main() {
    input! {
    n: usize,
    a: [i64; n]
    }
    let (mut l, mut r) = (-1_000_000_005, 1_000_000_005);
    let try_count = 100;
    for _ in 0..try_count{
        let mid_l = (l * 2 + r) / 3;
        let mid_r = (l + r * 2) / 3;
        if sadness(&a, mid_l) > sadness(&a, mid_r){
            l = mid_l;
        } else {
            r = mid_r;
        }
    }
    let mut ans = std::i64::MAX;
    for i in l..=r {
        ans = min(ans, sadness(&a, i));
    }
    println!("{}", ans);
}

fn sadness(a: &Vec<i64>, b: i64) -> i64 {
    a.iter().enumerate().map(|(i, &x)| (x - (b + i as i64 + 1)).abs()).sum::<i64>()
}


Measured memory_bytes: 5420
#include<stdio.h>
#include<iostream>
using namespace std;

int N;
int main (){
    cin >> N;
    double ans = 0;
    for(int i=0; i<N; i++) {
        double x;
        string u;
        cin >> x >> u;
        if( u[0] == 'J') {
            ans += x;
        } else {
            ans += x * 380000;
        }
    }

    printf("%f\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char a[3],b[3];
	scanf("%s",a);
	scanf("%s",b);
	if (a[0]==b[2] && a[1]==b[1] && a[2]==b[0]) {
		printf("YES\n");
	} else {
		printf("NO\n");
	}
	return 0;
}


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

int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}

int main(void){
    int n;
    scanf("%d",&n);
    int a[n],sum=0,not[n],count=0;
    for (int i=0; i<n; i++){
        scanf("%d",&a[i]);
        sum+=a[i];
        if (a[i]%10!=0){
            not[count]=a[i];
            count++;
        }
    }
    qsort (not,count,sizeof(int),sort);     
    if (sum%10!=0){
        printf("%d\n",sum);
    } else if (sum%10==0 && count==0) {
        printf ("0\n");
    } else {    
        printf("%d\n",sum-not[0]);
    }
	return 0 ;
}

Measured memory_bytes: 128
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest122-B
# 解説ベースの修正版 Vol1 20190328
#  https://atcoder.jp/contests/abc122/tasks/abc122_b

def solveProblem(inputString):
	stringLength = len(inputString)
	answerStringList = list()
	maxStringLength = 0
	for i in range(0,stringLength,+1):
		for j in range(i,stringLength,+1):
			AllATGCList = list()
			for c in inputString[i:j+1]:
				x = 'AGTC'.count(c) == 1
				AllATGCList.append(x)
			if all(AllATGCList) :
				strATGCLength = len(inputString[i:j+1])
				if maxStringLength < strATGCLength :
					maxStringLength = strATGCLength
	answer = maxStringLength
	return answer

if __name__ == '__main__':
	S = str(input().strip())
	solution = solveProblem(S)
	print("{}".format(solution))



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

int a[100];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	sort(a, a + N);
	reverse(a, a + N);

	int sum = 0;
	for(int i = 0; i < N; i++){
		if(i % 2 == 0) sum += a[i];
		else sum -= a[i];
	}
	cout << sum << endl;
}


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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    int h,n;cin>>h>>n;
    ll ans = 0;
    frepi(1,n,1)
    {
    	int x;cin>>x;
    	ans+=x;
    }
    if(ans>=h)
    	cout<<"Yes";
    else
    	cout<<"No";
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int where_a = 0;
  int where_z = 0;
  rep(i,n){
    if(s[i] == 'A'){
      where_a = i;
      break;
    }
  }//i
  for(int i=n-1;i>=0;i--){
    if(s[i] == 'Z'){
      where_z = i;
      break;
    }
  }//i
  cout << where_z - where_a + 1 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}

bool compareg(Pi a, Pi b) {
    if(a.second != b.second){
        return a.second > b.second;
        
    }else{
        return a.first > b.first;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

const vector<ll> d2{0, 1, 0, 2, 0, 1};
const vector<ll> d3{0, 0, 1, 0, 0, 1};
const vector<ll> d5{0, 0, 0, 0, 1, 0};



int main() {

    ll q;
    cin>>q;
    rep(lp,q){
    string X,Y;
    cin>>X>>Y;
    ll N = X.size();
    ll M = Y.size();
    vector<vector<ll>>dp(N+1,vector<ll> (M+1));

    rep(i,N){
        rep(j,M){
            if(X[i] == Y[j]){
                dp[i+1][j+1] = max({dp[i][j] + 1,dp[i+1][j],dp[i][j+1]});
            }else{
                dp[i+1][j+1] = max({dp[i][j] ,dp[i+1][j],dp[i][j+1]});
            }
        }
    }
    
    cout<<dp[N][M]<<endl;
    }
    return 0;
    

}



Measured memory_bytes: 10780
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
    ull N, M, ai, bi, n=0;
    ull ans=0, num=0;
    vector<pair<ull, ull>> cn;

    cin >> N >> M;
    for (int i=0; i<N; i++) {
        cin >> ai >> bi;
        cn.push_back(make_pair(ai, bi));
    }
    
    sort(cn.begin(), cn.end());
    while (num < M) {
        ai = cn[n].first;
        bi = cn[n].second;
        if (num+bi >= M) ans += ai * (M - num), num=M;
        else ans += ai * bi, num += bi;
        n++;
    }

    cout << ans << endl;

    return 0;
}


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

int gcd(int n, int m) {
	if (m == 0) {
		return n;
	}
	return gcd(m, n%m);
}

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

	sort(a.begin(), a.end());
	int g = a[0];
	for (int i = 1;i < n;i++) {
		g = gcd(g, a[i]);
	}
	if (k%g == 0 && k<=a[n-1]) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}




	return 0;
}

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

import static java.lang.Integer.parseInt;

/**
 * Programming Contest
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		line = br.readLine();
		int m = parseInt(line.substring(0, line.indexOf(' ')));
		int n = parseInt(line.substring(line.indexOf(' ') + 1));

		int max = -1;
		for (int i = 0; i < m; i++) {
			line = br.readLine();
			int sum = 0;
			for (int j = 0; j < n; j++) {
				if (line.charAt(j * 2) == '1') sum++;
			}
			max = Math.max(max, sum);
		}
		System.out.println(max);
	} // end main
}

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

int main() {
  int i = 1;
  int s, prev;
  vector<int> vec;
  cin >> s;
  s = int(s);
  vec.push_back(s);
  
  
  while (i < 1000000) {
    prev = vec.back();
    if (s % 2 == 0) {
      s = s / 2;
    } else {
      s = 3 * s + 1;
    }
    
    i++;
    
    if (find(vec.begin(), vec.end(), s) != vec.end()) break;
    else vec.push_back(s);
  }
  
  cout << i << endl;
}

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

#define sz(a) (int)a.size()
#define rep(i,x,n,j) for(int i=x; i<n; i+=j)

int main()
{
	int n; cin >> n;
	int a[n];
	rep(i,0,n,1) cin >> a[i];
	int done[(int)1e6+10]={0};
	rep(i,0,n,1){
		done[a[i]]++;
	}

	int ans = 0;
	rep(i,0,n,1){
		int counter=1;
		for(int j=1; j<=sqrt(a[i]); ++j){
			if(a[i]%j==0){
				if(j==1 && a[i]!=1 && done[1]>=1) counter=0;	
				if(j==1 && done[a[i]]>=2) counter=0;
				if(j!=1 && done[j]>=1) counter=0;
				if(j!=1 && done[a[i]/j]>=1) counter=0;
				
				if(counter==0) break;
			}
		}
		ans += counter;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8312
package main
import (
  "fmt"
  "sort"
)

func main() {
  var s string
  fmt.Scan(&s)
  var k int
  fmt.Scan(&k)
  arr := make([]string, 0, 10000000)
  m := make(map[string]bool)
  for i := 0; i < len(s); i++ {
    for j := i+1; j <= len(s); j++ {
      if k < j-i {
        continue
      }
      str := s[i:j]
      if m[str] {
        continue
      }
      m[str] = true
      arr = append(arr, s[i:j])
    }
  }
  sort.Strings(arr)
  result := arr[k-1]
  fmt.Println(result)
  
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    string str;
    cin>>str;
    ll n=str.length();
    if(n==1)
    {
        if(str[0]=='?')
        cout<<'D';
        else
        cout<<str;
        return;
    }
    for(ll i=0; i<n; i++)
    {
        if(str[i]!='?')
        continue;
        if(i>0&&str[i-1]=='P')
        {
            str[i]='D';
            continue;
        }  
        if(i<n-1&&str[i+1]=='?')
        {
            str[i]='P';
            str[i+1]='D';
            i++;
            continue;
            //cout<<str<<endl;
        }
        if(i==0&&(str[1]=='?'||str[1]=='D'))
        {
            str[i]='P';
            continue;
        }    
        if(i==0&&str[1]=='P')
        {
            str[i]='D';
            continue;
        }   
        if(i<n-1&&str[i+1]=='D')
        {
            str[i]='P';
            continue;
        }
        if(str[i-1]=='D')
        {
            str[i]='D';
            continue;
        }
    }
    cout<<str;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

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

					using namespace std;
					typedef long long ll;

					int main()
					{
						int n, m;
						  cin >> n;
						  string  s;
						  set<string> se;
						  for (int i = 1; i <= n; i ++)
						  {
						    string x;
						    cin >> x;
						    se.insert(x);
						  }
						  cout << se.size();
					}


Measured memory_bytes: 19220
import sys
input = sys.stdin.readline

n,q = map(int, input().split())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1, b-1
    G[a].append(b)
    G[b].append(a)


a = [0]*n
for i in range(q):
    p,x = map(int, input().split())
    p -= 1
    a[p] += x

# bfs
from collections import deque
q = deque()
q.append((0,0))
visited = [0]*n
ans = [0]*n
while q:
    cur, cost = q.popleft()
    if visited[cur]:
        continue
    visited[cur] = 1
    cost += a[cur]
    ans[cur] = cost
    for to in G[cur]:
        if not visited[to]:
            q.append((to, cost))

print(*ans)


Measured memory_bytes: 100464
import sys
from collections import defaultdict
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().strip().split()]
d = defaultdict(int)
for a in A:
    d[a] += 1
l = [(x - 1) % 2 for x in d.values() if x > 1 and x % 2 == 0]
print(len(d) - len(l) % 2)

Measured memory_bytes: 18656
#include <iostream>
#include <vector>

int main(void){
    using namespace std;
    int N;
    std::cin >> N;
    vector<int> d(N);

    for (int i = 0; i < N;i++)
        std::cin >> d[i];

    int ret = 0;
    for (int i = 0; i < N;i++){
        for (int j = i + 1; j < N; j++)
        {
            ret += d[i] * d[j];
        }
    }

    std::cout << ret << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
const int INF=2.147e9;
static inline int Max(const int x,const int y){return x>y?x:y;}
static inline int Min(const int x,const int y){return x<y?x:y;}
int main(void)
{
  int N=IN(),Umn=INF,Vmn=Umn,Umx=-INF,Vmx=Umx;
  while(N--){int x=IN(),y=IN();Umn=Min(x+y,Umn);Umx=Max(x+y,Umx);Vmn=Min(x-y,Vmn);Vmx=Max(x-y,Vmx);}
  return OUT(Max(Umx-Umn,Vmx-Vmn)),0;
}

Measured memory_bytes: 1508
#from string import ascii_lowercase
from bisect import bisect_right
s = input()
t = input()
p = {c: [] for c in s}
for x, c in enumerate(s):
    p[c].append(x)
z = 0
l = -1
for c in t:
    if c not in p:
        print(-1)
        break
    x = bisect_right(p[c], l)
    if x == len(p[c]):
        x = 0
        z += 1
    l = p[c][x]
else:
    print(z * len(s) + l + 1)


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9+7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


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

	int n, m;
	cin >>n >>m;
	
	map<ll, int> pc;
	rep(i, n) {
	int a,b;
		cin >> a >>b;
		pc[a] +=b;
	}
	ll ans =0;
	for(auto x: pc){
		if(x.second >= m){
			ans += x.first * m;
			break;
		}else{
			ans += x.first * x.second;
			m -= x.second;
		}
	}
	cout << ans <<"\n";
	return 0;
}




Measured memory_bytes: 6528
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    vector<int> dp(n, INF);

    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= min(i, k); j++) {
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
        }
    }

    cout << dp[n - 1] << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 4120
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a, b = map(str, input().split())
if ord(a) < ord(b):
    print("<")
elif ord(a) > ord(b):
    print(">")
else:
    print("=")


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

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

a,b,c = imn()
ma = Decimal(str(math.sqrt(a)))
mb = Decimal(str(math.sqrt(b)))
mc = Decimal(str(math.sqrt(c)))

da = Decimal(str(a))
db = Decimal(str(b))
dc = Decimal(str(c))
if da.sqrt() + db.sqrt() < dc.sqrt():
    print('Yes')
else:
    print('No')

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

int main(){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  cout << (s < t ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
N = int(input())
S = input()

lst = [0]*10

dic = {(i,j):set() for i in range(10) for j in range(10)}
a = set()
b = set()

for s_ in S:
  s = int(s_)
  for t in b:
    dic[t].add(s)
  for i in a:
    b.add((i,s))
  a.add(s)

rlt = 0
for c in dic:
  rlt += len(dic[c])
  
print(rlt)

Measured memory_bytes: 74000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007ll
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    string s;
    cin>>s;
    if(s=="AAA" || s=="BBB")
        cout<<"No";
    else
        cout<<"Yes";
    subt;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio> 
#include<cmath>
using namespace std;
int n,k,res,b[1000001],c[1000001];
char a[1000001];
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9')
		c=getchar();
	while ('0'<=c&&c<='9')
		sum=sum*10+c-'0',c=getchar();
	return sum;
}
int C(int a,int b)
{
	if (a<b) return 0;
	return 1;
}
int lucas(int a,int b)
{
	if (b==0)
		return 1;
	return C(a%2,b%2)*lucas(a/2,b/2)%2;
}
int main()
{
	n=read();
	for (int i=1;i<=n;++i) cin>>a[i];
	for (int i=1;i<=n;++i) b[i]=a[i]-'0';
	if (n==1)
	{
		printf("%d\n",b[1]);
		return 0;
	}
	for (int i=1;i<=n-1;++i)
		b[i]=abs(b[i]-b[i+1]);
	bool op=0;
	for (int i=1;i<=n-1;++i)
		if (b[i]==1) op=1;
	int res=0;
	if (!op)
	{
		for (int i=1;i<=n-1;++i)
			if (lucas(n-2,i-1))
				res^=(b[i]/2);
		printf("%d\n",res*2);
	}
	else
	{
		for (int i=1;i<=n-1;++i)
			if (lucas(n-2,i-1))
				res^=(b[i]%2);
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 8536
#include <stdio.h>

int selectionSort(int A[],int N){ 
  int i,j,t,sw=0,mini;
  for(i=0;i<N-1;i++){
  mini=i;
  for(j=i;j<N;j++){
   if(A[j]<A[mini] )mini=j;
  }
  t=A[i]; A[i]=A[mini];A[mini]=t;
  if(i!=mini) sw++;
 }
 return sw;
}

int main(){ 
 int A[100],N,i,sw;
 
 scanf("%d",&N);
 for(i=0;i<N;i++) scanf("%d",&A[i]);
 
 sw=selectionSort(A,N);
 
 for(i=0;i<N;i++){
  if(i>0) printf(" ");
  printf("%d",A[i]);
 }
 printf("\n");
 printf("%d\n",sw);
 
 return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum = 0;
  int st,en;
  for (int i = 0; i < N; i++) {
    cin >> st >> en;
    sum+= en-st+1;
  }
   cout << sum << endl; 
}

Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	prevX := scanInt(sc)
	x := scanInt(sc)

	d := abs(prevX - x)
	prevX = x

	for i := 1; i < n; i++ {
		x = scanInt(sc)
		d = gcd(d, abs(prevX-x))
		prevX = x
		if d == 1 {
			break
		}
	}
	fmt.Println(d)
}

func abs(n int) int {
	if n < 0 {
		return n * -1
	}
	return n
}

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	r := a % b
	for r > 0 {
		a = b
		b = r
		r = a % b
	}
	return b
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

Measured memory_bytes: 2176
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int main() {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> p(A), q(B), r(C);
  REP(i, A) cin >> p[i];
  REP(i, B) cin >> q[i];
  REP(i, C) cin >> r[i];
  sort(p.begin(), p.end(), greater<>());
  sort(q.begin(), q.end(), greater<>());
  REP(i, X) { r.push_back(p[i]); }
  REP(i, Y) { r.push_back(q[i]); }
  sort(r.begin(), r.end(), greater<>());
  ll ans = 0;
  REP(i, X + Y) { ans += r[i]; }
  cout << ans << endl;
}

Measured memory_bytes: 7868
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using pii = pair<int,int>;
using ll = long long;


int f(int n)
{
    int cnt = 0;
    for (int i=1; i*i <= n; ++i) {
        if (n % i == 0) {
            if (i*i == n) ++cnt;
            else cnt += 2;
        }
    }

    return cnt;
}


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

    int N;
    cin >> N;
    int ans = 0;
    for (int i=1; i<=N; i += 2) {
        if (f(i) == 8) ++ans;
    }

    outl(ans);

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n,d,x;
  cin>>n>>d>>x;
  int a[n];
  rep(i,n) cin>>a[i];
  int sum = 0;
  rep(i,n) {
    int day = 1;
    while(day <= d) {
      sum++;
      day += a[i];
    }
  }
  cout << sum + x << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n = 5;
    vi a(n);
    rep(i,n)cin >> a[i];
    sort(all(a));
    int ans = INF;
    do{
        int t = 0;
        rep(i,n){
            if(t % 10){
                t = (t/10 + 1)*10;
            }
            t += a[i];
        }
        ans = min(ans, t);
    }while(next_permutation(all(a)));
    cout << ans << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(v) cout<<v<<"\n"
const int NONE = 0, INC = 1, DEC = 2;

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

  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  int type = NONE;
  int ans = 1;
  rep(i, N-1) {
    if (A[i] == A[i+1])
      continue;
    if (A[i] > A[i+1]) {
      if (type == DEC) {
        ++ans;
        type = NONE;
      } else
        type = INC;
    } else {
      if (type == INC) {
        ++ans;
        type = NONE;
      } else
        type = DEC;
    }
  }
  out(ans);

  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
  int k,s;
  int count=0;
  scanf("%d %d",&k,&s);
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if((s-i-j)<=k&&(s-i-j)>=0){
        if(i+j+(s-i-j)==s){
          count++;
        }
      }
    }
  }

  printf("%d\n",count);
  return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	string s;
	cin >> s;

	string key = "keyence";
	if (s == key) {
		out("YES");
		return 0;
	}

	int n = sz(s);
	rep(i, n) {
		REP(j, i, n) {
			string ss = "";
			rep(k, n) {
				if (!(i <= k && k <= j)) {
					ss.push_back(s[k]);
				}
			}
			if (ss == key) {
				out("YES");
				return 0;
			}
		}
	}

	out("NO");

	return 0;
}

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

int toint(double n){
	if (n >= (int)n + 0.5){
		return (int)n + 1;
	}
	return (int)n;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	double m = n / 1.08;
	if (m != (int)m){
		m = (int)m + 1;
	}
//	cout << m << '\n';
//	cout << toint(toint(m * 1.08)) << '\n';
	if ((int)(m * 1.08) == n){
		cout << (int)m;
	}
	else{
		cout << ":(";
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)



int main() {
	int a[3][3];
	bool b[3][3];

	for (int y = 0; y < 3; y++) {
		for (int x = 0; x < 3; x++) {
			cin >> a[y][x];
			b[y][x] =false;
		}
	}
	int n;
	cin >> n;
	rep(i , n) {
		int c;
		cin >> c;
		rep(y, 3) {
			rep(x, 3) {
				if (a[y][x] == c) {
					b[y][x] = true;
				}
			} 
		}	
	}

	rep(y , 3) {
		bool is_ok = true;
		rep(x, 3) {
			if (!b[y][x]) {
				is_ok = false;
			}
		} 
		if (is_ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	rep(x , 3) {
		bool is_ok = true;
		rep(y, 3) {
			if (!b[y][x]) {
				is_ok = false;
			}
		} 
		if (is_ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	if ((b[0][0] && b[1][1] && b[2][2]) 
		|| (b[0][2] && b[1][1] && b[2][0])) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;

	
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
int main(){
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    rep(i,n){
        if(i%2 == 0){
            if(s[i] != '0'){
                ans++;
            }
        }
        else{
            if(s[i] != '1'){
                ans++;
            }
        }
    }
    cout << min(ans,n-ans) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long n,m,d,e,g,i,j,k,f,t,x,y,p,q;
long long A,B,C,X,Y,Z;
long long MIN ,ans,mid,MAX,num;
long long a[200050],b[200050],s[20000];
char str[200050];


int main()
{
    cin >> n;
    cin >> m;
    d=(n*(n-1))/2;
    e=(m*(m-1))/2;
    ans=d+e;
    cout << ans <<"\n";
    return 0;
}

Measured memory_bytes: 256
# Middle-Square Method

def middle_square(s, n)
  ss=(s**2).to_s
  ss='0'*(n*2-ss.length)<<ss
  ss[n/2..n+1].to_i
end

i=0
while (n=gets.to_i)!=0
  n.times {
    puts "Case #{i+=1}:"
    s=gets.to_i
    10.times {
      s=middle_square(s, 4)
      puts s
    }
  }
end

Measured memory_bytes: 6104
#include<stdio.h>
int main(){
    long long int t,a,b,s,f=0;
    scanf("%lld %lld %lld",&t,&a,&b);
    s=t+a-b;
    if(0<t<100000000000 || 0<a<100000000000 ||0<b<100000000000){
        if(t<=b){
        f=0;
        printf("%lld\n",f);
            if(s>0){
                printf("%lld\n",s);
            }
            else{
                 printf("%lld\n",s=0);
    }
        }
    else {
        printf("%lld\n",s-a);
        printf("%lld\n",a);
    }
}
return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

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

		for(int i=0;i<N;i++) {
			L[i] = sc.nextInt();
		}
		sc.close();

		if(N<3) {
			System.out.println(0);
			return;
		}

		int result = 0;
		for(int i=0;i<N-2;i++) {
			for(int j=i+1;j<N-1;j++) {
				for(int k=j+1;k<N;k++) {
					if(judge(L[i],L[j],L[k])) {
						result++;
					}
				}
			}
		}

		System.out.println(result);

	}

	public static boolean judge(int x,int y,int z) {
		if(x == y || x == z || y == z ) {
			return false;
		}

		if(x > y && x > z && y + z > x ) {
			return true;
		}

		if(y > z && y > x && x + z > y ) {
			return true;
		}

		if(z > x && z > y && x + y > z ) {
			return true;
		}

		return false;

	}

}

Measured memory_bytes: 27284
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    char c;
    cin >> c;

    if('a' <= c && c <= 'z'){
        cout << 'a' << endl;
    }
    else{
        cout << 'A' << endl;
    }

    return 0;
}



Measured memory_bytes: 3616
import heapq

n,m = map(int,input().split())
ab = sorted([list(map(int,input().split())) for _ in range(n)])

work = []
heapq.heapify(work)

idx = 0
res = 0
sz = 0
for i in range(m, -1, -1):
    dayleft = m - i
    while idx < n and ab[idx][0] <= dayleft:
        heapq.heappush(work, -ab[idx][1])
        sz += 1
        idx += 1
    if sz == 0:
        continue
    res -= heapq.heappop(work)
    sz -= 1
print(res)


Measured memory_bytes: 75352
#include <stdio.h>

int main(void)
{
  int n;
  long long ans = 1, i;
  int MOD = 1e9 + 7;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    ans = (ans * i) % MOD;
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;

    int ans;
    int def;
    for(int i=1;i<=100000;i++){
        if((i*i-i)/2>=N) {
            ans=i;
            def=((i*i-i)/2-N);
            break;
        }
    }
    for(int i=1;i<ans;i++){
        if(i==def) continue;
        cout << i << endl;
    }



}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
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 (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int c = 0;
	rep(i, 0, s.size()) {
		if (s[i] == s[s.size() - 1 - i])continue;
		c++;
	}
	cout << c/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    char a,b,c, tmp;

    cin >>a >> tmp >> tmp;
    cin >>tmp >> b >> tmp;
    cin >>tmp >> tmp >> c;

    cout << a << b  << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)

template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int ac = 0, wa = 0;
  int p, n;
  cin >> p >> n;
  vector<bool> ok(p+10, false);
  vector<int> ng(p+10);
  for (int i = 0; i < n; ++i) {
    int a; cin >> a; string b; cin >> b;
    if (b == "AC" && !ok[a]) {
      ok[a] = true;
      ac++;
      wa += ng[a];
    }
    if (b == "WA" && !ok[a]) {
      ++ng[a];
    }
  }
  cout << ac << " " << wa << '\n';
}


Measured memory_bytes: 640
N = int(input())

ans = [0 for _ in range(100001)]

for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 105):
            v = i*i + j*j + k*k + i*j + j*k + k*i
            if v < 10001:
                ans[v] += 1

for n in range(N):
    print(ans[n+1])


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<P> items(N);
    rep(i, N) {
        ll a;
        cin >> a;
        items[i] = make_pair(a, i);
    }
    sort(items.rbegin(), items.rend());
    vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0));
    rep(k, N) {
        P p = items[k];
        rep(i, N) {
            ll j = k - i;
            if (j < 0) continue;
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + abs(p.second - i) * p.first);
            dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + abs(p.second - (N - 1 - j)) * p.first);
        }
    }
    ll ans = 0;
    rep(i, N + 1) {
        rep(j, N + 1) {
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 34572
#include <stdio.h>

int main(void) {
  int w, fee;

  while (1) {
    scanf("%d", &w);
    if (w == -1) break;
    
    fee = 1150;
    if (w > 10) {
      if (w <= 20) fee += (w - 10) * 125;
      else {
	fee += 10 * 125;
	if (w <= 30) fee += (w - 20) * 140;
	else fee += 10 * 140 + (w - 30) * 160;
      }
    }

    printf("%d\n", 4280 - fee);
  }

  return 0;
}

Measured memory_bytes: 600
n, m, x = gets.split.map(&:to_i)
cas = n.times.map { gets.split.map(&:to_i) }

ans = -1

(1 << n).times do |bit|
  sums = Array.new(m + 1, 0)

  n.times do |i|
    (m + 1).times do |j|
      sums[j] += cas[i][j] * bit[i]
    end
  end

  if sums[1..-1].all? { |a| a >= x }
    if ans == -1
      ans = sums[0]
    elsif sums[0] <= ans
      ans = sums[0]
    end
  end
end

puts ans


Measured memory_bytes: 14512
# -*- coding: utf-8 -*-
num,h_target,m_target = map(int,input().split())
#cnt_2_in_str = lambda x: 1 if x == '2' else 0

h_list,m_list = [],[]
for i in range(0,num):
    h,m = map(int,input().split())
    h_list.append(h)
    m_list.append(m)

cnt = 0
for i in range(0,num):
    if h_list[i] >= h_target and m_list[i] >= m_target:
        cnt += 1

print(cnt)

Measured memory_bytes: 9228
n = int(input())
a = [int(i) for i in input().split()]

dp = [float("inf") for i in range(n)]
dp[0] = 0
dp[1] = abs(a[1] - a[0])

for i in range(n-2):
    dp[i+2] = min(dp[i] + abs(a[i+2] - a[i]),
                  dp[i+1] + abs(a[i+2] - a[i+1]))

print(dp[-1])

Measured memory_bytes: 13928
#include<stdio.h>
int min(int a,int b){
  if(a>b) return b;
  return a;
}
int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  printf("%d\n",min(c,b/a));
  return 0;
}

Measured memory_bytes: 128
a,b,k=[int(i) for i in input().split()]
if a>b:
	lst=[i for i in range(b,0,-1) if a%i==0 and b%i==0]
else:
	lst=[i for i in range(a,0,-1) if a%i==0 and b%i==0]
print(lst[k-1])

Measured memory_bytes: 3060
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]

for i in range(n):
    w_ = wv[i][0]
    v_ = wv[i][1]
    for j in range(w+1):
        if j - w_ >= 0:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w_] + v_)
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[-1][-1])


Measured memory_bytes: 171784
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

X = int(input())
ans = 0
N = 100

while N < X:
    ans += 1
    N += N // 100

print(ans)



Measured memory_bytes: 10808
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n, a,b; cin>>n>>a>>b;
  int a_cnt=0, b_cnt=0, c_cnt=0;
  rep(i,n) {
    int p; cin>>p;
    if (p<=a) a_cnt++;
    else if (p<=b) b_cnt++;
    else c_cnt ++;
  }
  int mn = min(a_cnt, b_cnt); 
  mn = min(mn, c_cnt);
  cout << mn << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, K;
vector<ll> a;

//x以下のペアがk個以上あるかどうか判定. trueとなる最小のxを返せばいい
bool knum(ll x) {
  ll ans = 0; 
  for (ll i = 0; i < N; i++) {
    if (a[i] > 0) {
      ll lb = -1; ll ub = N;
      while (ub - lb > 1) {
        ll mid = (ub+lb)/2;
        ((a[mid]*a[i] > x)? ub : lb) = mid;
      }
      if (ub == N) {ans += (N-1);}
      else if (i < ub) {ans += (ub-1);}
      else {ans += ub;}
    }
    else if (a[i] == 0) {
      if (x >= 0) {ans += (N-1);}
      else {continue;}
    }
    else if (a[i] < 0) {
      ll lb = -1; ll ub = N;
      while (ub - lb > 1) {
        ll mid = (ub+lb)/2;
        ((a[mid]*a[i] <= x)? ub : lb) = mid;
      }
      if (ub == N) {continue;}
      else if (i >= ub) {ans += (N-ub-1);}
      else {ans += (N-ub);}
    }
  }
  if (ans >= 2*K) {return true;}
  else {return false;}
}

int main() {
  cin >> N >> K;
  for (ll i = 0; i < N; i++) {
    ll x; cin >> x; a.push_back(x);
  }
  sort(a.begin(), a.end());
  
  ll lb = -1e18-1; ll ub = 1e18+1;
  
  //cout << knum(-8) << endl;
  
  while (ub - lb > 1) {
    ll mid = (ub+lb)/2;
    (knum(mid)? ub : lb) = mid;
  }
  cout << ub << endl;
}

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

int n, m, q;
vector<int> a, b, c, d;
int ans;
void dfs(vector<int> A) {
	if(A.size() == n + 1) {
		int now = 0;
		for(int i = 0; i < q; i++) {
			if(A[b[i]]-A[a[i]] == c[i]) now += d[i];
		}
		ans = max(ans, now);
		return;
	}
	A.push_back(A.back());
	while(A.back() <= m) {
		dfs(A);
		A.back()++;
	}
}
int main() {
	cin >> n >> m >> q;
	a = b = c = d = vector<int>(q);
	for(int i = 0; i < q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	vector<int> A(1,1);
	dfs(A);
	cout << ans << endl;
}

Measured memory_bytes: 3636