akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,i;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    cout<<a[n-1]-a[0];
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N,A[2][100],ans=0,maxn=-1;
int main(void){
	cin>>N;
	for(int i=0;i<2;i++)for(int j=0;j<N;j++)cin>>A[i][j];
	for(int i=0;i<N;i++){
		ans=0;
		for(int j=0;j<=i;j++)ans+=A[0][j];	
		for(int j=i;j<N;j++)ans+=A[1][j];
		maxn=max(ans,maxn);
	}
	cout<<maxn;
	return 0;
}

Measured memory_bytes: 256
list1 = input()
list2 = input()
list3 = input()
nlist1 = list1.split(' ')
nlist2 = list2.split(' ')
S = nlist1[0]
T = nlist1[1]
lenS = int(nlist2[0])
lenT = int(nlist2[1])
select = list3
if select == S:
    lenS -= 1
elif select == T:
    lenT -= 1
print(lenS,lenT)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)
#define myforInv(i,N) for(i=N;i>=0;i--)
#define myforFLInv(i,f,l) for(i=f;i>l;i--)

using namespace std;

int main(){
	string S;
	cin >> S;
	int i = S.size()-1; 
	if (S[i] == '2' || S[i] == '4' || S[i] == '5' || S[i] == '7' || S[i] == '9')cout << "hon" << endl;
	else if (S[i] == '3') cout << "bon" << endl;
	else cout << "pon" << endl;
	return 0;
}


Measured memory_bytes: 3056
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| String::from_str(n).unwrap());
    let a = it.next().unwrap();

    let mut c = HashSet::new();

    for i in 0..a.len() {
        c.insert(a.chars().nth(i));
    }

    if c.len() == a.len() {
        println!("yes");
    } else {
        println!("no");
    }
}


Measured memory_bytes: 4352
#pragma GCC optimize("O3")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("Ofast")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include<bits/stdc++.h>
    #define int long long
    # define mo 1000000007
    using namespace std;
    #define goku ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    signed main(){
        goku
   int n;
   cin>>n;
   int a[n];
   pair<int,int> ar[n];
   for(int i=0;i<n;i++){
    cin>>a[i];
    ar[i].first=a[i];
    ar[i].second=i;
   }
   sort(ar,ar+n);
   int mi=INT_MAX,an=0;
   for(int i=0;i<n;i++)
   {
       if(mi>ar[i].second)
       {
           an++;
           mi=ar[i].second;
       }
   }
   cout<<an;
   return 0;
    }


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int n,a[200001];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=2;i<=n;i++)if(a[i]==a[i-1])
{
puts("NO");
return 0;
}
puts("YES");
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int N; 
int x[1010], y[1010];


using line = tuple<int, int, int>; //ax + by + c = 0;
line pass(int x1, int y1, int x2, int y2)
{
  int A = y2-y1;
  int B = x1-x2;
  int C = y1*x2-y2*x1;
  if(A<0) A = -A, B = -B, C = -C;
  if(A==0 && B<0) B = -B, C = -C;
  int g = __gcd(A, __gcd(B, C));
  A /= g; B /= g; C /= g;
  
  
  return line(A, B, C);
}

const int MOD = 998244353;

int main()
{
  int pow2[202]; pow2[0] = 1;
  map<line, int> M;
  scanf("%d", &N);
  for(int i=0; i<N; ++i) scanf("%d%d", x+i, y+i);
  for(int i=1; i<=N; ++i) pow2[i] = pow2[i-1]*2%MOD;
  for(int i=0; i<N; ++i)
    for(int j=0; j<i; ++j)
    {
      line l = pass(x[i], y[i], x[j], y[j]);
      M[l] = M[l] + 1;
    }
  int ans = (pow2[N]-1+MOD-N)%MOD; // {}, singleton
  for(auto x: M)
  {
    int cnt = x.second;
    int il = sqrt(cnt*2)+1;
    ans = (ans + MOD - pow2[il])%MOD; // >2
    ans = (ans + il) % MOD; // = 1
    ans = (ans + 1) % MOD; // = 0
  }
  printf("%d\n", ans);
  return 0;
}





Measured memory_bytes: 1536
#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 = (int)(1e9) + 7;
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 <class It>
long long merge(It l, It m, It r) {
	long long cnt = 0;
	vector<int> tmp(r - l);
	It it = tmp.begin(), it1 = l, it2 = m;
	while (it1 != m && it2 != r) {
		if (*it1 < *it2)
			*it++ = *it1++;
		else
			*it++ = *it2++, cnt += m - it1;
	}
	while (it1 != m) *it++ = *it1++;
	while (it2 != r) *it++ = *it2++;
	move(tmp.begin(), tmp.end(), l);
	return cnt;
};

template <class It>
long long mergeSort(It l, It r) {
	if (r - l <= 1)return 0;
	long long cnt = 0;
	It m = l + (r - l) / 2;
	cnt += mergeSort(l, m);
	cnt += mergeSort(m, r);
	cnt += merge(l, m, r);
	return cnt;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	vector<int> a(N); rep(i, 0, N) {
		cin >> a[i];
	}
	vector<int> b(N + 1);
	rep(i, 0, N) {
		b[i + 1] += b[i] + a[i] - K;
	}
	reverse(all(b));
	cout << mergeSort(all(b)) << endl;
	return 0;
}

Measured memory_bytes: 5796
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		//String t = sc.next();
		//long n = sc.nextLong();
		//long m = sc.nextLong();
		//long k = sc.nextLong();
		//long l = sc.nextLong();
		//long count=0;

		/*for(int i=0;i<3;i++) {
			if(s.substring(i,i+1).equals(s.substring(i+1,i+2))) {
				count++;
			}else if(i!=2){
				count=0;
			}
		}*/
		/*if(n+m<k+l) {
			System.out.println("Right");
		}else if(n+m>k+l){
			System.out.println("Left");
		}else {
			System.out.println("Balanced");
		}*/
		//System.out.println((int)Math.ceil((n+m)/2.0));
		System.out.println(s.replace("2017", "2018"));
	}
}




Measured memory_bytes: 21332
k, a, b  = map(int, input().split() )


#print(b-a)
if b-a <= 2:
    print(k+1)

else: 
    tap = a-1

    remK = k-tap

#    print('remK = {}'.format(remK) )
    ans = a
    ans += (remK // 2) *( b-a ) + remK % 2
    print(ans)

 

        


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<ll>total(n);
	rep(i, n) {
		cin >> a[i];
		total[i] = a[i];
	}
	ll ans = n;
	ll cnt = 1;
	sort(a.begin(), a.end());
	rep(i, n - 1) {
		if (a[i + 1] > a[i] * 2) {
			ans -= cnt;
			cnt = 1;
		}
		else {
			cnt++;
		}
		a[i + 1] += a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4788
//
// Created by Hideaki Imamura on 2020-03-17.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
ll a[3100];
ll dp[3100][3100];

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

    // dp[i][j] = 元の数列から連続する区間[i,j)をとった局面からスタートした時、X-Yの値
    for (int i = 0; i < N; ++i) dp[i][i] = 0;

    for (int len = 1; len <= N; ++len) {
        for (int i = 0; i + len <= N; ++i) {
            int j = i + len;
            if ((N - len) % 2 == 0) {
                dp[i][j] = dp[i+1][j] + a[i];
                chmax(dp[i][j], dp[i][j-1] + a[j-1]);
            } else {
                dp[i][j] = dp[i+1][j] - a[i];
                chmin(dp[i][j], dp[i][j-1] - a[j-1]);
            }
        }
    }

    cout << dp[0][N] << endl;
    return 0;
}

Measured memory_bytes: 73984
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

template <typename T>
void say(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}


/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	vi a(3);
	cin >> a;
	sortall(a);
	vi b = { 5, 5, 7 };
	YN(a == b);

	return 0;
}

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

int main () {
  int N;
  long long a = 1;
  long long b = 1;
  long long c = 1;
  cin >> N;
  for (int i = 0; i < N; i++){
    a *= 10;
    b *= 9;
    c *= 8;
    a %= 1000000007;
    b %= 1000000007;
    c %= 1000000007;
  }
  long long x = a - 2*b + c;
  x %= 1000000007;
  while (x < 0) x += 1000000007;
  cout << x << endl;
}

Measured memory_bytes: 3532
// id: ALDS1_2_B
#include <stdio.h>

#define MAX_N 100

int selection_sort(int a[], int n);

int main(void)
{
	int arr[MAX_N];
	int n, swap_times;

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

	swap_times = selection_sort(arr, n);

	printf("%d", arr[0]);
	for ( int i = 1; i < n; ++i )
		printf(" %d", arr[i]);
	printf("\n");
	printf("%d\n", swap_times);

	return 0;
}

int selection_sort(int a[], int n)
{
	int cnt = 0;

	for ( int i = 0; i < n - 1; ++i ) {
		int minj = i;
		int minv = a[i];

		for ( int j = i + 1; j < n; ++j )
			if ( a[j] < minv ) {
				minv = a[j];
				minj = j;
			}

		if ( minj != i ) {
			a[minj] = a[i];
			a[i] = minv;
			++cnt;
		}
	}

	return cnt;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
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;}




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

int a,b;
cin >> a >> b;

int ans = 1;

if(b == 1) {
    cout << 0 << endl;
    return 0;
}

while(1){
    if(a*ans - (ans -1) >= b) break;
    ans++;
}

cout << ans << endl;

return 0;
}

Measured memory_bytes: 256
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.hypot(x2-x1, y2-y1)
    if dist+r2 < r1:
        print(2)
    elif dist+r1 < r2:
        print(-2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)


Measured memory_bytes: 5664
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <stack>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using pari=pair<lolo, lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
using Rpriority_queue=priority_queue<lolo, vector<lolo>, greater<lolo>>;
using priority_Q = priority_queue<lolo>;

#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORIT(it,V) for (auto it=V.begin(); it!=V.end(); ++it)
#define FORANGE(v, V) for (auto v : v)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define REVCNT(i, const_cnt, N) for (lolo i=N-1, cnt=const_cnt; cnt > 0; --cnt, --i)
#define ALL(x) x.begin(), x.end()

lolo get10(lolo x) {
	lolo ans = 0;
	while (x) {
		ans += x % 10;
		x /= 10;
	}
	return ans;
}

int main()
{
//#if _DEBUG
//	lolo _K;
//	cin >> _K;
//	FOR(i, 190) {
//		cout << i * _K << " :  " << get10(i * _K) << endl;
//	}
//	return 0;
//#endif
	lolo K;
	cin >> K;
	
	const auto MOD = K;
	//deque<pari> DQ;
	auto f = [](auto a, auto b) {
		return a.second > b.second;
	};
	priority_queue<pari, vector<pari>, decltype(f) > PQ(f);
	PQ.push(make_pair(1, 1));
	//priority_Q DQ;

	lolo ans = 0;
	//set<lolo> sVisited = { 1 };
	vec vVisited( K, numeric_limits<lolo>::max() );
	

	while (!PQ.empty()) {
		auto v = PQ.top(); PQ.pop();
		if (v.first % K == 0) {
			ans = v.second; break;
		} 		
		auto val = v.first % K;
		auto cost = v.second;

		if (vVisited[val] > cost) {
			vVisited[val] = cost;
			auto x10 = (v.first * 10) % MOD;
			auto plus10 = (v.first + 1) % MOD;
			if (vVisited[x10] > v.second) { 
				PQ.push(make_pair(x10, v.second));
				//vVisited[x10] = v.second;
			}

			if (vVisited[plus10] > v.second + 1) { 
				PQ.push(make_pair(plus10, v.second + 1));
				//vVisited[plus10] = v.second + 1;
			}
		}
	}

	cout << ans << endl;

}



Measured memory_bytes: 2168
//STANLEGENDS_STANEXO
//EXO_WEAREONE
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,b;
	cin>>n;
	if(n<10)
		{cout<<n;}
	else if(n>9 && n<100){cout<<"9";}
	else if(n>99 && n<1000)
	{  b=n-90;
	cout<<b;}
	else if(n>999 && n<10000)
		{cout<<"909";}
	else if(n>9999 && n<100000)
	{
       b=n-9090;
       cout<<b;
	}
	else if(n==100000){cout<<"90909";}
}

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

using namespace std;

int main() {
	string S[3];

	cin >> S[0] >> S[1] >> S[2];
	int i[] = { 0,0,0 };
	int now = 0;
	while( true ) {
		//cout << now << endl;
		if( S[now].size() > i[now] ) {
			i[now]++;
			now = S[now][i[now] - 1] - 'a';
		} else {
			cout << ( char )(now + 'A') << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>

const long long INF = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N;
    cin >> N;
    vector<llong> A(N);
    map<llong, llong> Table;

    for(int i=0; i<N; i++){
        cin >> A[i];
        Table[A[i]] += 1;
        Table[A[i]-1] += 1;
        Table[A[i]+1] += 1; 
    }
    vector<llong> list;

    for(auto x:Table){
        list.push_back(x.second);
    }
    sort(list.begin(), list.end());
    cout << list[list.size()-1] << endl;
    return 0;
}


Measured memory_bytes: 10560
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

// ベクターに売り上げを記録していく。
// 同じ社員が複数のデータを持つこともあるので、
// 記録がある場合には加算していく。
// 1000000以上の場合に社員番号を出力する。
// 該当する社員0人の場合はNAを出力する。

int main() {

	int N;
	while (cin >> N , N != 0) {
		vector<pair<int, long long>> data;

		for (int i = 0; i < N; ++i) {
			int number, price, sales;
			cin >> number >> price >> sales;
			auto it = find_if(data.begin(), data.end(), [number](pair<int, int> x) {return x.first == number;});
			auto total = static_cast<long long>(price) * sales;
			if (it != data.end()) {
				it->second += total;
			}
			else {
				data.emplace_back(pair<int, long long>{number, total});
			}
		}
		int cnt = 0;
		for (const auto a : data) {
			if (a.second >= 1000000) {
				++cnt;
				cout << a.first << endl;
			}
		}
		if (0 == cnt) {
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

using T = long double; ///__float128;

T angle (const pair<int, T> &l, const pair<int, T> &r)
{
	assert(l.first < r.first);
	return (r.second - l.second) / (r.first - l.first);
}

void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int n;

	while (cin >> n)
	{
		vector<ll> a(n), b(n);
		for (auto &it : a)
			cin >> it;
		for (auto &it : b)
			cin >> it;

		const int pos_max = max_element(a.begin(), a.end()) - a.begin();
		rotate(a.begin(), a.begin() + pos_max, a.end());
		rotate(b.begin(), b.begin() + pos_max, b.end());
		assert(*max_element(a.begin(), a.end()) == a.front());

		vector<T> pot(int(b.size()) + 1);
		for (int i = 2; i < int(pot.size()); i++)
			pot[i] = 2 * pot[i - 1] + 2 * b[i - 1] - pot[i - 2];

		vector<T> value(pot.size());
		for (int i = 0; i < int(value.size()); i++)
			value[i] = a[i % int(a.size())] - pot[i];

		vector<pair<int, T>> pts;
		pts.emplace_back(0, value[0]);

		for (int i = 1; i < int(value.size()); i++)
		{
			pair<int, T> cur(i, value[i]);
			while (pts.size() >= 2U && angle(pts[int(pts.size()) - 2], pts.back()) < angle(pts.back(), cur))
				pts.pop_back();
			pts.push_back(cur);
		}
		assert(pts.back().first == int(pot.size()) - 1);

		vector<T> res(int(pot.size()), -T(1e100));
		for (int i = 0; i + 1 < int(pts.size()); i++)
		{
			const T len = pts[i + 1].first - pts[i].first;
			for (int j = pts[i].first; j <= pts[i + 1].first; j++)
				res[j] = T(pts[i + 1].first - j) / len * pts[i].second + T(j - pts[i].first) / len * pts[i + 1].second;
		}

		for (int i = 0; i < int(pot.size()); i++)
			res[i] += pot[i];
		res.pop_back();
		for (int i = 0; i < int(res.size()); i++)
			assert(res[i] >= a[i]);

		const T ans = accumulate(res.begin(), res.end(), T(0)) / T(res.size());

		cout << fixed << setprecision(15);
		cout << (long double)ans << endl;
	}
}

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

#ifdef LOCAL
	auto st = clock();
	ifstream fin("../input.txt");
	solve(fin);

	cout << "clock: " << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}

Measured memory_bytes: 21884
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,range(26)):
    sco-=cli[i][j]
  solution.append(con)

stemp=1000000
etemp=10
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(10)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  try:
    prob = math.exp((sc-sco)/tem())
  except:
    prob=0

  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)



Measured memory_bytes: 10200
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
using namespace std;

vector<vector<pair<long long, long long>>> con(100100);
int N;
long long u, v, w;
int dp[100100];

void solve(long long x) {
    int len = con[x].size();
    for (int i=0; i<len; ++i) {
        if (dp[con[x][i].first] < 0) {
            if (con[x][i].second % 2 == 0) dp[con[x][i].first] = dp[x];
            else {
                if (dp[x] == 0) dp[con[x][i].first] = 1;
                else dp[con[x][i].first] = 0;
            }
            solve(con[x][i].first);
        }
    }

    return;
}

int main() {
    cin >> N;
    for (int i=1; i<=N; ++i) dp[i] = -1;
    for (int i=0; i<N-1; ++i) {
        cin >> u >> v >> w;
        con[u].push_back(make_pair(v, w));
        con[v].push_back(make_pair(u, w));
    }

    dp[1] = 0;
    solve(1);
    long long cnt = 0;
    for (int i=1; i<N; ++i) {
        cnt += dp[i];
        cout << dp[i] << endl;
    }
    if (cnt == 0) dp[N] = 1;
    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 9856
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner (System.in);
		// 入力
		String s = sc.next();

		int ans = 0;
		for(int i = 0; i < s.length(); i++){
			//System.out.println(s.charAt(i));
			if (s.charAt(i)=='+') {
				ans++;
			} else {
				ans--;
			}
		}
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <limits>
#include <cstdio>

using namespace std;

int main(){
  int N; cin >> N;
  int sum = 0;
  vector<int> v;
  for(int i = 0; i < N; i++){
    int temp;
    scanf("%d", &temp);
    sum += temp;
    v.push_back(temp);
  }
  long long min = numeric_limits<long long>::max();
  for(int i = -100; i < 101; i++){
    long long tmp = 0;
    for(int j = 0; j < N; j++){
      tmp += (v[j] - i) * (v[j] - i);
    }
    if(tmp < min)
      min = tmp;
  }
  cout << min << "\n";
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: u64,
        b: u64,
    }
    let l = a * b / gcd(a, b);
    
    println!("{}", l);
}

fn gcd(a: u64, b: u64) -> u64 {
    if a % b == 0 {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Long x = scanner.nextLong();

        for(Long i = x; i < x*x; i++) {
            if(x == 2L) {
                System.out.println(i);
                System.exit(0);
            }
            if ( i % 2 == 0) continue;
            for(Long j = 2L; j < x; j++) {
                if(i % j == 0L) {
                    break;
                }
                if(x-1L == j) {
                    System.out.println(i);
                    System.exit(0);
                }
            }
        }

    }
}


Measured memory_bytes: 25300
#include <iostream>
#include <fstream>
#include <vector>
#include <bits/stdc++.h>
#include <iterator>
using namespace std;
int main(){
    int x;
    cin >> x;
    if(x>=400 && x<600)
       	cout << 8;
    else
    if(x>=600 && x<800)
       	cout << 7;
    else
    if(x>=800 && x<1000)
     	cout << 6;
    else
    if(x>=1000 && x<1200)
     	cout << 5;
     	else
    if(x>=1200 && x<1400)
     	cout << 4;
    else
    if(x>=1400 && x<1600)
     	cout << 3;
     	else
    if(x>=1600 && x<1800)
     	cout << 2;
     	else
    if(x>=1800 && x<2000)
     	cout << 1;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int sum = 0;
		if (a < b){
			sum += b;
			b = b-1;
		}else{
			sum += a;
			a = a-1;
		}
		if (a < b){
			sum += b;
			b = b-1;
		}else{
			sum += a;
			a = a-1;
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 23892
#include<iostream>
#include<math.h>

using namespace std;

int main(){
    long long x=1;
    long long  y=1;
    long long  z=1;
    long long w;
    long long v;
    int n;
    int mod = 1000000007;

    cin >> n;

    for(int i=0; i<n; i++){
        x *= 9;
        x %= mod;
        y *= 8;
        y %= mod;
        z *= 10;
        z %= mod;
    }
    w = z - y;
    if(w < 0) w+=mod;
    v = z - x;
    if(v < 0) v+=mod;
    w = (2*v)%mod -w;
    if(w < 0)w +=mod;
  
    cout << w << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long N=scan.nextLong();
		long a[]=new long[(int) (N+1)];
		a[0]=0;
		a[1]=scan.nextLong();
		for(long i=2;i<N+1;i++){
			long c=scan.nextLong();
			a[(int) i]=a[(int) (i-1)]+c;
		}
		Arrays.sort(a);
		long ans=0;
		long co=0;
		for(long i=1;i<N+1;i++){
			if(a[(int) i]!=a[(int) (i-1)]){
				if(co!=0){
					ans+=(co+1)*co/2;
					co=0;
				}
			}
			else{
				co++;
			}
		}
		ans+=(co+1)*co/2;
		System.out.println(ans);
	}
}


Measured memory_bytes: 78076
/**
*    created: 03.07.2020 15:20:02
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    int ans = 1900 * m + 100 * (n - m);
    rep(i,m) {
        ans *= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define MOD 1000000007
typedef long long LL;
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

int main(void) {
	int x;
	cin >> x;

	if (1200 > x) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ARC" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
    int n,i;
    cin >> n;
    int a[n];
    for(i = 0;i < n;i++){
        cin >> a[i];
    }
    for(i = n-1;i >= 0;i--){
        if(i-n+1) cout << " ";
        cout << a[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3120
n=int(input())
a=[0]+list(map(int,input().split()))
a+=[0]

cost=0
pre=0
for i in range(n+2):
    cost+=abs(a[i]-pre)
    pre=a[i]
#print(a,cost)
for i in range(n):
    if (a[i]-a[i+1])*(a[i+1]-a[i+2])<0:
        print(cost-2*(min(abs(a[i]-a[i+1]),abs(a[i+1]-a[i+2]))))
    else:
        print(cost)
        

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

n = int(input())
a = list(map(int, input().split()))
cnt1, now = 0, 0

for i in range(n):
    now += a[i]
    
    if i%2==0:
        if now<=0:
            cnt1 += 1-now
            now = 1
    else:
        if now>=0:
            cnt1 += now+1
            now = -1
    
cnt2, now = 0, 0

for i in range(n):
    now += a[i]
    
    if i%2==1:
        if now<=0:
            cnt2 += 1-now
            now = 1
    else:
        if now>=0:
            cnt2 += now+1
            now = -1

print(min(cnt1, cnt2))

Measured memory_bytes: 84380
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

//解説AC。最も効率的なマッチング方法が思い付かず。
//二部グラフの最大マッチング問題を勉強する。

struct xy{
  int x, y;
  xy(){}
  xy(int a, int b){x = a; y = b;}
};

bool xmin(xy a, xy b){
  return a.x < b.x;
}
bool ymax(xy a, xy b){
  return a.y > b.y;
}

int main(){
  int N;
  cin >> N;
  vector<xy> r(N), b(N);
  for(int i = 0; i < N; i++){
    cin >> r.at(i).x >> r.at(i).y;
  }
  sort(ALL(r), ymax);

  vvi BR(N, vi(0)); //i番目の青とペアになれる赤の番号
  for(int i = 0; i < N; i++){
    cin >> b.at(i).x >> b.at(i).y;
  }
  sort(ALL(b), xmin);

  for(int i = 0; i < N; i++){//青
    for(int j = 0; j < N; j++){//赤
      if(r.at(j).x < b.at(i).x && r.at(j).y < b.at(i).y){
        BR.at(i).push_back(j);
      }
    }
  }

  int ans = 0;
  vector<bool> rflag(N, true); //赤がペア作成済みか。
  for(int i = 0; i < N; i++){
    for(int j = 0; j < BR.at(i).size(); j++){
      if(rflag.at(BR.at(i).at(j))){
        rflag.at(BR.at(i).at(j))= false;
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <functional>
using namespace std;

int main() {
	string str1, str2;
	cin >> str1 >> str2;
	sort(str1.begin(), str1.end());
	sort(str2.begin(), str2.end(), greater<char>());
	if (str1 < str2)	cout << "Yes" << endl;
	else				cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
    int H[99999], W[99999];
    int num;
    int i = 0;
    while(true){        
        scanf("%d %d", &H[i], &W[i]);
       // printf("input is %d %d", H[i], W[i]);
        if(H[i] == 0 && W[i] == 0){
            num = i;
            break;
        }
        
        i++;
    }
    //printf("i is %d\n", i);
    for(int i=0;i<num;i++){
        for(int j=0;j<H[i];j++){
            for(int k=0;k<W[i];k++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");            
    }
    //printf("\n");    
    return 0;
}


Measured memory_bytes: 2704
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 110, M = 100100;
int n, W;
ll w[N], v[N];
ll mem[N][M + N];
ll dp(int i, ll wight){
    if(wight > W)
        return -2e9;
    if(i == n)
        return 0;
    ll &ret = mem[i][wight];
    if(ret != -1)
        return ret;
    return ret = max(dp(i+1, wight+w[i]) + v[i], dp(i+1, wight));
}
int main(){
    memset(mem, -1, sizeof mem);
    cin>>n>>W;
    for(int i = 0; i < n; ++i)
        cin>>w[i]>>v[i];
    cout<<dp(0, 0);
    return 0;
}


Measured memory_bytes: 86400
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define rv(s) reverse(s.begin(),s.end());
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
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; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int q;cin>>q;
  
  rep(ki,q){
    string x,y;
    cin>>x>>y;
    int m=x.size();
    int n=y.size();
    int dp[1001][1001];
    
    rep(i,m)dp[i][0]=0;
    rep(i,n)dp[0][i]=0;
    
    for(int i=1;i<=m;i++){
      for(int j=1;j<=n;j++){
        if(x[i-1]==y[j-1]){
          dp[i][j]=dp[i-1][j-1]+1;
        }else{
          dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
      }
    }
    
    cout(dp[m][n]);
  }
}


Measured memory_bytes: 7112
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main() {
	int n, i;
	double s[1000], sum, var, sd, m;
	while (1) {
		cin >> n;
		if (n == 0)break;
		sum = 0;
		for (i = 0; i < n; i++) {
			cin >> s[i];
			sum += s[i];
		}
		m = sum / n;
		var = 0;
		for (i = 0; i < n; i++) {
			var += (s[i] - m) * (s[i] - m);
		}
		var /= n;
		sd = sqrt(var);
		cout << setprecision(10) << sd << endl;
	}
	return 0;
}

Measured memory_bytes: 1296
#include <iostream>
#include <string>

using namespace std;

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

  int A[26] = {0};

  for (int i = 0; i < S.size(); ++i) {
    char ch = S[i] - 'a';
    ++A[ch];
  }

  char hit =0;
  for (int i = 0; i < 26; ++i) {
    if (!A[i]) {
      hit = 'a' + i;
      break;
    }
  }

  if (hit) {
    cout << hit << endl;
  } else {
    cout << "None" << endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<map>
#include<queue>
#include<algorithm>
#include<iostream>

#define FI first
#define SE second

using namespace std;

map<string,string> maap;
string x;

int main(){
    maap["G"] = "C";
    maap["C"] = "G";
    maap["T"] = "A";
    maap["A"] = "T";
    cin>>x;
    cout<<maap[x]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> alp(26, 0);
    for(int i=0; i<N; i++){
        string P;
        cin >> P;
        alp[P[0]-'A']++;
    }

    int ans = 0;
    while(true){
        sort(alp.begin(), alp.end(), greater<int>());
        if(alp[K-1] == 0) break;
        for(int i=0; i<K; i++)
            alp[i]--;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    
    N,M = map(int,input().split())
    one = {}
    enu = {}
    
    for i in range(M):
        a,b = map(int,input().split())
        if a==1:
            one[b] = 1
        elif b==1:
            one[a] = 1
        elif a==N:
            enu[b] = 1
        elif b==N:
            enu[a] = 1
    flag = 0
    for i in one:
        if i in enu:
            flag = 1
            break
    if flag==1:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
    
    
main()

Measured memory_bytes: 61148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s1s2s3;
  cin >> s1s2s3;
  cout << s1s2s3 / 100 + s1s2s3 % 100 / 10 + s1s2s3 % 100 % 10 << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef unsigned long long ull;

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define ep emplace_back
#define EL printf("\n")
#define sz(A) (int) A.size()
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FOD(i,r,l) for (int i=r;i>=l;i--)
#define fillchar(a,x) memset(a, x, sizeof (a))
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


struct two {
	int i, j, type, id;
};

const int   N = 500001, Q = 500001, A = 1000001;
int         n, q, res[Q], last_pos[A], bit[N];
two        a[N+Q];

bool cmp(two u, two v) {
	return (u.j < v.j or (u.j == v.j and u.type < v.type));
}

void update(int x, int k) {
	for (x; x<=n; x+=x&-x) bit[x] += k;
}

int get(int x) {
	int ans = 0;
	for (x; x>0; x-=x&-x) ans += bit[x];
	return ans;
}



int main() {

	scanf("%d%d", &n,&q);
	for (int i=1; i<=n; i++)
		scanf("%d", &a[i].i), a[i].j = i, a[i].type = -1;
	for (int i=1; i<=q; i++)
		scanf("%d%d", &a[i+n].i, &a[i+n].j), a[i+n].id = i;

	sort(a+1,a+n+q+1,cmp);

	for (int i=1; i<=n+q; i++) {
		if (a[i].type == -1) {
			update(a[i].j, 1);
			if (last_pos[a[i].i] > 0) update(last_pos[a[i].i], -1);
			last_pos[a[i].i] = a[i].j;
		} else {
			res[a[i].id] = get(a[i].j) - get(a[i].i-1);
		}
	}

	for (int i=1; i<=q; i++) printf("%d\n", res[i]);

	return 0;
}


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

#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];

    vector<vector<long>> d(n, vector<long>(n));
    // d[i][j] - закончили в i ст, взяли j ст

    long res = LONG_MAX;
    if (k == n) {
        res = 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0) {
                d[i][j] = h[i];
            } else {
                d[i][j] = LONG_MAX;
                for (int t = 0; t < i; t++) {
                    if (j - 1 > t) continue;
                    long dd = d[t][j - 1];
                    if (h[i] > h[t]) {
                        dd += h[i] - h[t];
                    }
                    d[i][j] = min(d[i][j], dd);
                }
                if (j + 1 == n - k) {
                    res = min(res, d[i][j]);
                }
            }
//            cout << i << " " << j << " " << d[i][j] << "\n";
        }
    }
    cout << res;

    return 0;
}

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

using namespace std;
string s;
vector<int> v;
int main(){ 

int ans =0;
cin>>s ;
int cnt =0;
for(int i=0;i <s.size();i ++){
char c=s[i];
int j=c-'0';
cnt +=j;
}
int num =stoi(s);
ans =num %cnt;
if(ans ==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}


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

int main() {
    string s; cin >> s;
    
    int k; cin >> k;
    int n = s.size();
        
    vector<pair<int, int>> v;

    for(int i = 0; i < n; i += 1) {
        s[i] -= 1;
        if(v.empty()) 
            v.push_back(make_pair(s[i], 1));
        else if (v.back().first == s[i]) {
            v.back().second += 1;
        } else {
            v.push_back(make_pair(s[i], 1));
        }
    }

    int vv = v.size();
    
    if(vv == 1) {
        cout << (1LL * k * n) / 2 << "\n";
        return 0;
    }

    if(v[0].first != v.back().first) {
        int64_t ans = 0;
        for(int i = 0; i < vv; i += 1) {
            ans += 1LL * k * (v[i].second / 2);
        }
        cout << ans << "\n";
    } else {
        int64_t ans = 0;
        for(int i = 1; i < vv - 1; i += 1) {
            ans += 1LL * k * (v[i].second / 2);
        }

        ans += v[0].second / 2;
        ans += v.back().second / 2;

        ans += 1LL * (k - 1) * ((v[0].second + v.back().second) / 2);
        cout << ans << "\n";
    }

}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		long[] b = new long[n];
		for(i=0;i<n-1;i++) {
			b[i] = parseLong(sc.next());
		}
		sc.close();
		long sum = b[0];
//		out.println(sum);
		for(i=1;i<n-1;i++) {
			sum += Math.min(b[i-1], b[i]);
		}
//		out.println(sum);
		sum += b[n-2];
		out.println(sum);
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string S[n];
    set<string>s;
    for(int i=0;i<n;i++){
        cin>>S[i];
        s.insert(S[i]);
    }
    cout<<s.size()<<endl;
    return 0;
}

Measured memory_bytes: 25312
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream& is, vector<t> &x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream& is, pair<t, u> x){
    is >> x.first >> x.second;
    return is;
}


int main(){
    int n = in();
    vector<int> pos(n);
    cin >> pos;
    ll ans = INF;
    rep(i, 101){
        ll sum = 0;
        foreach(j, pos){
            sum += (i-j)*(i-j);
        }
        chmin(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll MOD = 998244353;

ll mod_pow(ll a, ll b, ll p) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return res;
}


const int MAX_N = 112345;
int D[MAX_N];

int solve(int N) {
  if (D[0] != 0) return 0;
  map<int,int> count;
  int ma = 0;
  REP(i, N) {
    ++count[ D[i] ];
    chmax(ma, D[i]);
  }
  if (count[0] != 1) return 0;

  ll ans = 1;
  for (int i = 1; i <= ma; i++) {
    ans *= mod_pow(count[i-1], count[i], MOD);
    ans %= MOD;
  }
  return ans;
}

int main2() {
  int N = nextInt();
  REP(i, N) D[i] = nextInt();
  ll ans = solve(N);
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A;
 
  B = N % 500;
  if (A >= B) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256