akhauriyash/Code-Regression huggingface dataset:
# python3.4.2用
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 lprint(l): print(*l, sep='\n')

S = input()

for i in range(0,len(S),2):
    if S[i:i+2] != 'hi':
        print('No')
        break
else:
    print('Yes')

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

using namespace std;

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

    int ans;
    if (s == "SUN") ans = 7;
    else if (s == "MON") ans = 6;
    else if (s == "TUE") ans = 5;
    else if (s == "WED") ans = 4;
    else if (s == "THU") ans = 3;
    else if (s == "FRI") ans = 2;
    else if (s == "SAT") ans = 1;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

int main(){
	int N; cin >> N; string s; cin >> s;
	int a[26] = {0};
	rep(i, s.size()){
		a[s[i] - 'a']++;
	}
	ll ans = 1;
	rep(i, 26){
		ans *= (a[i] + 1);
		ans %= MOD;
	}

	COUT(ans - 1);
}

Measured memory_bytes: 512
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  int n,m;cin>>n>>m;

  vi x(n);
  vi used(n);
  int ans = 0;
  int wa = 0;
  rep(i, m){
    int p;cin>>p;p--;
    string s;cin>>s;
    if (used[p]) continue;

    if (s=="AC"){
      ans++;
      used[p] = 1; 
    }
    else{
      x[p]++;
    }
  }
  rep(i, n){
    if (used[i]) wa += x[i];
  }
  cout << ans << " " << wa << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
ll gcd(ll a,ll b){
	if(b==0)
	return a;
	return gcd(b,a%b);
}
string toBin(ll a) {
	string res = "";
	while (a) {
		res += char((a & 1) + '0');
		a >>= 1;
	}
	reverse(res.begin(), res.end());
	return res;
}
const int mod = 1e9+7;
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){
            ans = ans*base;
            ans = ans%mod;
        }
        base *= base;
        base%=mod;
        pow/=2;
    }
    return ans;
}
ll inv(ll x){
    return expo(x,mod-2);
}
bool isPal(string ss){
    int len = ss.length();
    for(int i = 0 ; i<len/2 ; i++){
	int comp = len-i-1;
	if(ss[i]!=ss[comp])
		return false;
	}
    return true;
}
double pi = 3.141592653589793238462643;
double error = 0.0000001;
/* -------Template ends here-------- */

const int M = 100001;

map<ll , int> mp;
vector<ll> vec;
int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
   int n;
   si(n);
   ll el;
   for(int i = 0 ; i<n ; i++){
        sll(el);
        vec.push_back(el);
        mp[el] = i;
   }
    sort(vec.begin() , vec.end());
    int k = 0;
    for(int i = 0 ; i<n ; i++){
        ll ex = vec[i];
        int on = mp[ex];
        int tw = i;
        if((on%2==1 && tw%2==0) || (on%2==0 && tw%2==1)){
            k++;
        }
    }

    cout<<k/2;





}














Measured memory_bytes: 7284
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

template<class T> class squarematrix{
public:
	size_t n;
	vector<vector<T>> mat;
	constexpr squarematrix(size_t _n) : n(_n), mat(vector<vector<T>>(n, vector<T>(n, 0))) {}
	constexpr squarematrix(vector<vector<T>> v) : n(v.size()), mat(v) {}
	constexpr squarematrix operator*(const squarematrix rhs) const {
		return squarematrix(*this) *= rhs;
	}
	constexpr vector<T> operator*(const vector<T> rhs) const {
		vector<T> v(n, 0);
		for(size_t i=0; i<n; ++i)
			for(size_t j=0; j<n; ++j)
				v[i] |= mat[i][j] & rhs[j];
		return v;
	}
	constexpr squarematrix &operator*=(const squarematrix rhs){
		squarematrix<T> tmp(mat);
		for(size_t i=0; i<n; ++i)
			for(size_t j=0; j<n; ++j){
				mat[i][j] = 0;
				for(size_t k=0; k<n; ++k)
					mat[i][j] |= tmp.mat[i][k] & rhs.mat[k][j];
			}
		return *this;
	}
	constexpr vector<T> &operator[](const size_t i){
		return mat[i];
	}
	static constexpr squarematrix diag(size_t n, T t){
		squarematrix<T> diag_mat(n);
		for(size_t i=0; i<n; ++i)
			for(size_t j=0; j<n; ++j)
				diag_mat[i][j] = (i == j ? t : 0);
		return diag_mat;
	}
};
template<class T> T pwr(T a, T e, Int n){
	while(n > 0){
		if(n & 1) e *= a;
		a *= a;
		n >>= 1;
	}
	return e;
}

bool solve(Int n, Int m, Int z){
	vector<vector<Int>> g(n); // adjacency list of graph
	for(Int i=0; i<m; ++i){
		Int s, d; cin >> s >> d;
		--s; --d;
		g[s].push_back(d);
		g[d].push_back(s);
	}
	vector<Int> d; // degree of a vertex
	for(Int i=0; i<n; ++i) d.push_back(g[i].size());
	Int V = accumulate(d.begin(), d.end(), 0);
	++V;
	map<pair<Int, Int>, Int> mp; // (now, from) -> num
	for(size_t i=0; i<g.size(); ++i)
		for(size_t j=0; j<g[i].size(); ++j)
			mp[make_pair(i, g[i][j])] = accumulate(d.begin(), d.begin()+i, 0)+j;
	squarematrix<Int> M(V);
	for(size_t i=0; i<g.size(); ++i)
		for(size_t j=0; j<g[i].size(); ++j)
			for(size_t k=0; k<g[i].size(); ++k)
				if(j != k){
					// (g[i][j] -> ) i -> g[i][k]
					M[mp[make_pair(g[i][k], i)]][mp[make_pair(i, g[i][j])]] = 1;
				}
	for(size_t i=0; i<g[0].size(); ++i)
		M[mp[make_pair(g[0][i], 0)]][V-1] = 1;
/*	cout << "---M---\n";
	for(Int i=0; i<V; ++i)
		for(Int j=0; j<V; ++j)
			cout << M[i][j] << " \n"[j+1==V];
	cout << "-------\n";
*/	squarematrix<Int> E = squarematrix<Int>::diag(V, 1);
	squarematrix<Int> P = pwr<squarematrix<Int>>(M, E, z);
/*	cout << "---P---\n";
	for(Int i=0; i<V; ++i)
		for(Int j=0; j<V; ++j)
			cout << P[i][j] << " \n"[j+1==V];
	cout << "-------\n";
*/	vector<Int> vec(V, 0);
	vec[V-1] = true;
	vec = P * vec;
/*	cout << "--vec--\n";
	for(Int i=0; i<V; ++i)
		cout << vec[i] << " \n"[i+1==V];
	cout << "-------\n";
*/	for(size_t i=0; i<g[n-1].size(); ++i)
		if(vec[accumulate(d.begin(), d.begin()+n-1, 0)+i])
			return true;
	return false;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	while(1){
		Int n, m, z; cin >> n >> m >> z;
		if(n == 0) return 0;
		cout << (solve(n, m, z) ? "yes" : "no") << "\n";
	}
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)

using namespace std;
typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {
    
    int N = in();
    int M = in();
    

    cout << (int)pow(2,M)*(1900*M + (N-M)*100) << endl;
}






Measured memory_bytes: 256
a = []

for i in range(3):
    a.append(list(map(int,input().split())))
    
N = int(input())

b=[]
for i in range(N):
    b.append(int(input()))
    

AA = [[0] * 3 for i in range(3)]

for bb in b:
    for i in range(3):
        for j in range(3):
            if a[i][j] == bb:
                AA[i][j] = 1
                
ans = 'No'

for i in AA:
    if sum(i) == 3:
        ans='Yes'

for i in range(3):
    if AA[0][i]+AA[1][i]+AA[2][i] == 3:
        ans='Yes'
        
if AA[0][0]+AA[1][1]+AA[2][2] == 3:
    ans ='Yes'
    
if AA[0][2]+AA[1][1]+AA[2][0] == 3:
    ans ='Yes'
    
        
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
const ll limit = 2e9;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);	
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};


bool vis[107][107];
int dis[107][107];

struct nod{
	int x, y, d;
	nod(int x_, int y_, int d_){
		x = x_;
		y = y_;
		d = d_;
	}
};

bool ok(int x, int y, int n, int m){
	return 0 <= x && x < n && 0 <= y && y < m;
}

int shortestPathBinaryMatrix(vector<vector<int>>& g) {
	clr(dis,0);
	int n = (int)g.size();
	int m = (int)g[0].size();
	
	queue<nod> q;
	q.push(nod(0,0,1));
	vis[0][0] = true;
	dis[0][0] = 1;
	while(!q.empty()){
		int x = q.front().x;
		int y = q.front().y;
		int d = q.front().d;
		q.pop();
		for(int k = 0; k < 8; k++){
			int a = x + dx[k];
			int b = y + dy[k];
			if(ok(a,b,n,m) && !vis[a][b] && g[a][b] == 0){
				vis[a][b] = true;
				dis[a][b] = d + 1;
				q.push(nod(a,b,d+1));
			}
		}
	}
	if(dis[n-1][n-1] != 0)
		return dis[n-1][n-1];
    return -1;
}

char v[10] = {'#','1','2','3','4','5','6','7','8','9'};
vector<string> p; 
void perm(int l, int r){
	
	if(l == r){
		string str = "";
		for(int i = 1; i <= r; i++){
			
			str += v[i];
		}
		
		p.push_back(str);
		return;
	}
	
	for(int i = l; i <= r; i++){
		swap(v[l],v[i]);
		perm(l+1,r);
		swap(v[l],v[i]);
	}
}

int main()
{	
	
		int n, x; cin>> n>> x;
	if(n*500 >= x)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
ABs = list([list(map(int,input().split())) for _ in range(M)])
 
ship1 =[]
shipn =[]
 
for ab in ABs:
    if ab[0]==1:ship1.append(ab[1])
    elif ab[1]==N:shipn.append(ab[0])
 
      
if list(set(ship1) & set(shipn)) ==[]:print('IMPOSSIBLE')
else:print('POSSIBLE')


Measured memory_bytes: 61304
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    int x, y, z;
    while  (cin >> x >> y >> z) {
        int a = x - z;
        cout << a / (y + z) << endl;
    }
}


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

string a,b="CF"; //打表
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ //当找到一个的时候加一
            bl++;
            if(bl==2)   //都找到的时候就退出
                break;
        }
    if(bl==2) cout<<"Yes"; //判断并且输出
    else cout<<"No";
    cout<<endl;//最后不要忘了打个换行
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Program
    {
        
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int T = int.Parse(input[2]);

            Console.WriteLine(T / A * B);
            
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

LLi mod=1000000007;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}
 
LLi modinv(LLi a) {
    LLi b = mod, u = 1, v = 0;
    while (b) {
        LLi t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

int main(){

	LLi n, m, ans=0, tmp;
	vector<LLi> v;
	vector<LLi> con(1), par;

	cin>> n >> m;
	par.resize(m+1);
	
	con[0]=1;
	for(int i=1;i<=m;i++){
		tmp=con[i-1];
		tmp*=n+1-i;
		tmp=tmp%mod;
		tmp*=modinv((LLi)i);
		tmp=tmp%mod;
		con.push_back(tmp);
		//cout<< n << "C" << i << "=" << con[i] <<endl;
	}

	par[m]=1;
	for(int i=0;i<n;i++){
		par[m]*=(m-i);
		par[m]=par[m]%mod;
	}
	for(int i=m-1;i>0;i--){
		par[i]=par[i+1]*modinv((LLi)i+1);
		par[i]=par[i]%mod;
	}
	par[0]=1;

	//rep(i, m+1) cout<< par[i] <<endl;

	for(int i=0;i<=n;i++){
		tmp=con[i]*par[m-i];
		tmp=tmp%mod;
		if(i%2==0) ans+=tmp;
		else ans-=tmp;
		ans=(mod+ans)%mod;
	}

	ans*=par[m];
	ans=ans%mod;

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

Measured memory_bytes: 11248
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
string S;long long power[11];
int main(){
	power[0]=1;for(int i=1;i<11;i++)power[i]=power[i-1]*10;
	cin>>S;int a[10]={0,1,2,3,4,5,6,7,8,9};
	long long X=0;string Y="";
	do{
		long long P1=stoll(S);
		long long P2=0;
		for(int i=0;i<S.size();i++){
			P2+=power[i]*a[i];
		}
		long long SA=min(abs(P1-P2),power[S.size()]-abs(P1-P2));
		string G="";for(int i=0;i<S.size();i++){G+=(char)('0'+a[S.size()-1-i]);}
		if(SA>X || (SA==X && Y>G)){X=SA;Y=G;}
	}while(next_permutation(a,a+10));
	cout<<Y<<endl;
	return 0;
}

Measured memory_bytes: 3200
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int,int> pii;

const int INF=1e9+7;

bool con[5][5];

int main(){
	FOR(i,0,3){
		int u,v;
		scanf("%d%d",&u,&v);--u;--v;
		con[u][v]=con[v][u]=1;
	}
	FOR(a,0,4) FOR(b,0,4) FOR(c,0,4) FOR(d,0,4){
		if(a==b||a==c||a==d||b==c||b==d||c==d) continue;
		if(con[a][b]&&con[b][c]&&con[c][d]){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort()
from bisect import bisect_right
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):ans+=bisect_right(a,a[j]+a[i]-0.5)-j-1
print(ans)

Measured memory_bytes: 44380
mod = 998244353
N, M, K = map(int, input().split())

list_size = 2*10**5 + 4

f_list = [1] * list_size
f_r_list = [1] * list_size
 
for i in range(list_size-1):
	f_list[i+1] = (f_list[i] * (i+1)) % mod
 
f_r_list[-1] = pow(f_list[-1], mod - 2, mod)
 
for i in range(list_size-2, -1, -1):
	f_r_list[i] = (f_r_list[i+1] * (i+1)) % mod
 
def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod

ans = 0
for k in range(K+1):
    ans += (comb(N-1, k, mod) * M *pow(M-1, N-k-1, mod))%mod
ans %= mod
print(ans)

Measured memory_bytes: 24488
using System;
using System.Collections.Generic;
using System.Linq;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int K;
            var parseRet = int.TryParse(Console.ReadLine(), out K);
            if (!parseRet)
            {
                K = int.MaxValue;
            }
            string store = string.Empty;
            foreach (var s in S)
            {
                if (string.IsNullOrEmpty(store))
                {
                    store += s.ToString();
                    if (s != '1')
                    {
                        break;
                    }
                }
                else
                {
                    if (s == '1')
                    {
                        store += s.ToString();
                    }
                    else
                    {
                        store += s.ToString();
                        break;
                    }
                }
            }

            if (store.Length < K)
            {
                Console.WriteLine(store.Last());
            }
            else
            {
                Console.WriteLine(store[K - 1]);
            }
        }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<int>height;
	for(int i=0;i<n;i++)
	{
	    int x;
	    cin>>x;
	    height.push_back(x);
	}
	vector<int>dp(n,INT_MAX);
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
	    for(int j=i+1;j<=i+2;j++)
	    {
	        if(j<n)
	        {
	            dp[j]=min(dp[j],dp[i]+abs(height[i]-height[j]));
	        }
	    }
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 3936
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

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

int main(void) {
    double r;
    char buf[8];

    (void)fgets(buf, 8, stdin);
    sscanf(buf, "%lf", &r);

    printf("%lf\n", r * 2 * M_PI);
    
    
    return 0;
}


Measured memory_bytes: 3776
//AtCoder ABC103 B - String Rotation
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
    string S,T; cin>>S>>T;
    bool ans=S==T;
    for(ll i=0;i<S.size();++i){
        auto s = S.back();
        S.pop_back();
        S.insert(S.begin(),s);
        if(S==T)ans=true;
    }
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}

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

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

    string s;
    cin >> s;

    string ans = "Yes";
    for (int i = 0; i < a + b + 1; i++) {
        if (i == a && s[i] != '-') {
            ans = "No";
            break;
        } else if (i != a && (s[i] < '0' || '9' < s[i])) {
            ans = "No";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
    int n;
    int s=0;
    cin>>n;
    vi v;
    rep(i,n){
        int tmp;
        cin>>tmp;
        s+=tmp;
        v.push_back(tmp);
    }
    int ans;
    int mi=100000;
    int t=0;
    rep(i,n){
        t+=v[i];
        s-=v[i];
        mi=min(mi,abs(t-s));
    }
    cout<<mi<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] arg) {
        long N, X;
        Scanner scan = new Scanner(System.in);
        N = scan.nextLong();
        X = scan.nextLong();
        long[] a = new long[(int)N + 1];
        long[] p = new long[(int)N + 1];
        a[0] = 1;
        p[0] = 1;

        for (int i = 1; i <= N; i++) {
            a[i] = 2 * a[i - 1] + 3;
            p[i] = 2 * p[i - 1] + 1;
        }
        scan.close();
        System.out.println(f(N, X, a, p));
    }

    private static long f(long N, long X, long[] a, long[] p) {
        if (X == 1) {
            return N == 0 ? 1 : 0;
        }
        else if (X <= 1 + a[(int)N - 1]) {
            return f(N - 1, X - 1, a, p);
        }
        else if (X == 2 + a[(int)N - 1]) {
            return p[(int)N - 1] + 1;
        }
        else if (X <= 2 + 2 * a[(int)N - 1]) {
            return p[(int)N - 1] + 1 + f(N - 1, X - 2 - a[(int)N - 1], a, p);
        }
        else {
            return 2 * p[(int)N - 1] + 1;
        }
    }
}

Measured memory_bytes: 23764
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

use rand::prelude::*;

const CN: usize = 26;

fn calc(cv: &[isize], sv: &[Vec<isize>], tv: &[usize]) -> isize {
    let mut last = vec![0; CN];
    let mut res = 0;
    for i in 0..sv.len() {
        let t = tv[i];
        res += sv[i][t];
        last[t] = i + 1;
        for j in 0..CN {
            res -= cv[j] * (i + 1 - last[j]) as isize;
        }
    }
    res
}

fn gen_tv(rng: &mut rand::rngs::ThreadRng, d: usize) -> Vec<usize> {
    (0..d)
        .into_iter()
        .map(|_| rng.gen::<usize>() % CN)
        .collect::<Vec<_>>()
}

fn main() {
    input! {
        d: usize,
        cv: [isize; CN],
        sv: [[isize; CN]; d],
    };

    let mut rng = rand::thread_rng();
    let mut tv = gen_tv(&mut rng, d);
    let mut res = calc(&cv, &sv, &tv);
    for _ in 0..300000 {
        let di = rng.gen::<usize>() % d;
        let q = rng.gen::<usize>() % CN;
        let old = tv[di];
        tv[di] = q;
        let p = calc(&cv, &sv, &tv);
        if p > res {
            res = p;
        } else {
            tv[di] = old;
        }
    }
    println!("{}", tv.into_iter().map(|x| x + 1).join("\n"));
}


Measured memory_bytes: 2756
// inputに入力データ全体が入る
function Main(input) {
    let row = parseInt(input.split("\n"), 0);
    if (row == 1){
        console.log(0);
    }else{
        console.log(1);
    }
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 29676
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
ll n,m,k,ans;
string s,t;
const ll powll = 1LL<<1;

int main(){
  ll a,b; cin >> a >> b;
  cout << a*b/__gcd(a,b) << "\n";
  // vector<int> v = {};
  // while(t--){}
  // rep(i,v.size()) cout << v[i] << "\n";
}

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

using namespace std;

int main()
{
	int n, x;
	cin >> n >> x;
	
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	sort(a.begin(), a.end());
	
	int ans = 0;
	for(int i = 0; i < a.size(); i++) {
		if(a[i] <= x) {
			ans++;
			x -= a[i];
			
			if(i == a.size() - 1 && x > 0) {
				ans--;
			}
		}
		else {
			break;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==b)cout<<"Draw"<<endl;
  else if(a>b){
    if(b==1){
      cout<<"Bob"<<endl;
    }
    else{
      cout<<"Alice"<<endl;
    }
  }
  else{
    if(a==1){
      cout<<"Alice"<<endl;
    }
    else{
      cout<<"Bob"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
s = Array.new(n){ gets.chomp.bytes.sort }.sort

ans = 0
cnt = 0
n.times do |i|
    
    if i == n - 1 or s[i] != s[i+1]
        ans += (cnt+1)*cnt/2
        cnt = 0
    else
        cnt += 1
    end
end

puts ans

Measured memory_bytes: 21752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n, h, w;
  cin >> n >> h >> w;
  ll res = 0;
  rep(i, n) {
    ll a, b; cin >> a >> b;
    if (a>=h && b>=w) res++;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int cards[4][13];
	int i,j,n,num;
	char ch;	

        scanf("%d",&n);

	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			cards[i][j]=0;
		}

	}
	for(i=0;i<n;i++){
		scanf(" %c %d",&ch,&num);
		if(ch=='S'){
			cards[0][num-1]=num;
		}
		if(ch=='H'){
			cards[1][num-1]=num;
		}
		if(ch=='C'){
			cards[2][num-1]=num;
		}
		if(ch=='D'){
			cards[3][num-1]=num;
		}
	}

	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(cards[i][j]==0){
				if(i==0) printf("S ");
				if(i==1) printf("H ");
				if(i==2) printf("C ");
				if(i==3) printf("D ");
				printf("%d\n",j+1);
			}
		}

	}	
	return 0;
}


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

const long long INF = 1LL << 60;
 
 
bool vector_finder(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}

std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
 
 
int main() {
  ll a, b, c, d;

  cin >> a >> b >> c >> d;

  ll ans = -INF;
  ll tmp = 0;

  ll tmp1 = b * a;

  if (b * d > ans) {
    ans = b * d;
  }

  if (a * d > ans) {
    ans = a * d;
  }

  if (a * c > ans) {
    ans = a * c;
  }

  if (b * c > ans) {
    ans = b * c;
  }

  if ((b >= 0 && a <= 0) || (d >= 0 && c <= 0)) {
    if (ans < 0) {
      ans = 0;
    }
  }
  
  


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

Measured memory_bytes: 3596
package main

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

func solve() {
	l := scanInt()
	r := scanInt()
	d := scanInt()
	cnt := 0
	for ; l <= r; l++ {
		if l%d == 0 {
			cnt++
		}
	}
	fmt.Println(cnt)
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}

func pow(n, m int) int {
	ret := 1
	for i := 0; i < m; i++ {
		ret *= n
	}
	return ret
}

func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func eratosthenes(n int) []int {
	search := make([]bool, n+1)
	ans := []int{}
	for i := 2; i < n+1; i++ {
		search[i] = true
	}
	for i := 2; i*i < n+1; i++ {
		for j := 2; i*j < n+1; j++ {
			search[i*j] = false
		}
	}
	for i := 2; i < n; i++ {
		if search[i] {
			ans = append(ans, i)
		}
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 1772
//ehhhhh...... i hate you......

/* optimizations and other useless stuff*/
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define INF 1e14
#define ull unsigned long long int
using namespace std;
/* TYPE DEFINITIONS */
typedef     long long int   ll;
typedef     vector<ll>      vi;
typedef     pair<ll,ll>     pi;


/* Basic  Math!!! */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll ncr(int n, int k)  
{  
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
} 

/* MACROS */
#define  all(A)         (A).begin() , (A).end()
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).sbegin()) it = (a).begin(); it != (a).end(); it++)  
void solve()
{
    ll n,c=0,k;
    cin>>n>>k;
    ll arr[n];
    forn(i,n)cin>>arr[i];
    ll dp[n+1];
    forn(i,n+1)dp[i]=INF;
    dp[0]=0;
    //dp[1]=abs(arr[0]-arr[1]);
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<=k;j++)
            if(i-j>=0)dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
    }
    cout<<dp[n-1]<<endl;
}

int main()
{
    FastIO;
    ll c=0;
    ll t=1;
   // cin>>t;
    while(t--)
    {
        //cout<<"Case "<<++c<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
N, M = map(int, input().split())
exists = True
digits = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if N > 1 and s == 1 and c == 0:
        exists = False
        break
    elif digits[s-1] == -1 or digits[s-1] == c:
        digits[s-1] = c
    else:
        exists = False
        break
if exists:
    ans = 0
    digits = list(reversed(digits))
    for i in range(N):
        if digits[i] == -1:
            if i == N - 1 and N > 1:
                digits[i] = 1
            else:
                digits[i] = 0
        ans += (10 ** i)*digits[i]
    print(ans)
else:
    print(-1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b << endl;
    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  int n, m, l;
  cin >> n >> m >> l;
  auto p = in(vectors(n, m, 0LL));
  auto q = in(vectors(m, l, 0LL));
  auto r = vectors(n, l, 0LL);
  rep(i, n) rep(j, l) rep(k, m) r[i][j] += p[i][k] * q[k][j];
  cout << r << endl;
}



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

int n,m,k;
bool ok;
int main(){
	cin>>k;
	cin>>n>>m;
	for (int i=n;i<=m;i++){
		if (i % k==0) ok=true;
	}
	if (ok==true)cout<<"OK\n";
	else cout<<"NG\n";
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int D; 
int c[30];
int s[400][30];
int t[400];


ll cal_score(int temp[]){
    int last[30] = {0};
    ll score = 0;
    for(int d=1;d<=D;++d){
        int i = temp[d];
        score += s[d][i];
        last[i] = d;
        for(int j=1;j<=26;++j){
            score -= c[j]*(d-last[j]);
        }
        //cout << score << "\n";
    }
    return score;
}

int main(){
    cin >> D;
    for(int i=1;i<=26;++i){ cin >> c[i]; }
    for(int d=1;d<=D;++d){ for(int i=1;i<=26;++i){ cin >> s[d][i]; } }
    
    int score_max = 0;
    
    default_random_engine e1(29624389);
    uniform_int_distribution<int> uniform_dist(1, 26);   
    
    REP(count,1000){
        int temp[400];
        for(int d=1;d<=D;++d){
            temp[d] = uniform_dist(e1);
            for(int i=1;i<=26;++i){
                if((double)s[d][i]>(double)s[d][temp[d]]*1.4){
                    temp[d] = i;
                }
            }
        }
        if(cal_score(temp)>score_max){
            for(int d=1;d<=D;++d){
                t[d] = temp[d];
            }
        }
    }
    for(int d=1;d<=D;++d){
        cout << max(t[d]%27,1) << "\n";
    }
}


Measured memory_bytes: 3700
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	as := scanInts(n)

	var sum int
	for i := 1; i < n; i++ {
		if as[i-1] > as[i] {
			sum += as[i-1] - as[i]
			as[i] = as[i-1]
		}
	}

	fmt.Println(sum)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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


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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ld long double

using namespace std;

const int INF = 1e9 + 7;
const ld conv = acos(-1)/180.0;

int main(void)
{
	FAST
	
	ld a, b, h, m;
	cin >> a >> b >> h >> m;
	
	ld mn = 6*m;
	ld hour = 30*h + 0.5*m;
	
	ld diff = max(mn, hour) - min(mn, hour);
	
	if(diff > 180.0) diff = 360.0 - diff;
	
	if(diff == 0) 
	{
		printf("%.20Lf", (max(a,b)-min(a,b)) );
	}else
	{
		printf("%.20Lf", (sqrtl(a*a + b*b - (2*a*b*cosl(diff*conv)))));
	}
	
	return 0;
}


Measured memory_bytes: 4176
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define PI 3.1415


int main() {
    
    int r;
    cin >> r;
    cout<<(double)2.0*PI*r<<endl;


 return 0;
}


Measured memory_bytes: 3788
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  string str;

  cin >> str;

  int ans = 0;
  for (size_t i = 0; i < str.length(); i++) {
    if (str[i] == '+')
      ans++;
    else
      ans--;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;
 
int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if((A*B) <= C){
        cout << A*B << endl;
    }
    else cout << C << endl;;
}

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

namespace ConsoleApplication1.CodeForces
{
    class _4032
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        class Node : IComparable
        {
            public long X { get; set; }
            public long Y { get; set; }
            public int CompareTo(object obj)
            {
                if (this.Y > ((Node)obj).Y)
                {
                    return 1;
                }
                if (this.Y == ((Node)obj).Y)
                {
                    return 0;
                }
                return -1;
            }
        }
        public static string ReverseString(string s)
        {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }
        static void Main(String[] args)
        {
            var n = int.Parse(Console.ReadLine().TrimEnd());
            var data = Console.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();
            var sum = data.Sum();
            long sum1 = 0;
            long min = long.MaxValue;
            for(var i = 0; i < n-1; i++)
            {
                sum1 += data[i];
                long sum2 = sum - sum1;
                var res = sum1 - sum2;
                min = Math.Min(Math.Abs(res), min);
            }
            

            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 35124