akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}
 

void solve()
{
 
 int n;
 cin >> n;

 int a[n] , sum=0;

 forf(i,0,n) cin >> a[i];

 
 forf(i,0,n)
 {
  forf(j,i+1,n)
  {
    sum += a[i]*a[j];
  }
 }
 
 cout<<sum<<"\n";
}


int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

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

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	ll n; cin >> n;
	vector<vector<ll>> cnt( 20, vector<ll>( 20 ) );
	vector<ll> v;

	rep( i, n )
	{
		string s; cin >> s;
		string t = "", u = "";
		auto idx = string::npos;
		if ( ( idx = s.find( "." ) ) != string::npos )
		{
			t = s.substr( 0, idx );
			u = s.substr( idx + 1 );
			while ( u.length() < 9 ) u += "0";
		}
		else
		{
			t = s;
			u = "0";
		}

		v.eb( atoll( t.c_str() ) * 1e9 + atoll( u.c_str() ) );
	}

	arep( it, v )
	{
		ll tcnt = 0, fcnt = 0;
		while ( it % 2 == 0 && tcnt < 18 )
		{
			it /= 2;
			++tcnt;
		}
		while ( it % 5 == 0 && fcnt < 18 )
		{
			it /= 5;
			++fcnt;
		}

		++cnt[tcnt][fcnt];
	}

	ll ans = 0;
	rep( i, 19 )
	{
		rep( j, 19 )
		{
			rep( k, 19 )
			{
				rep( l, 19 )
				{
					if ( i + k < 18 || j + l < 18 )
						continue;
					if ( i == k && j == l )
						ans += cnt[i][j] * ( cnt[k][l] - 1 );
					else
						ans += cnt[i][j] * cnt[k][l];
				}
			}
		}
	}

	cout << ans / 2 << endl;

	return ( 0 );
}


Measured memory_bytes: 4936
// atcoder/abc131/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  while (cin >> n >> k) {
    vector<pair<int, int>> v;
    for (int i = 1; i < n; ++i) {
      v.push_back({0, i});
    }
    vector<pair<int, int>> u;
    for (int i = 1; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        u.push_back({i, j});
      }
    }
    int x = (n - 1) * (n - 2) / 2;
    while (k < x && u.size()) {
      v.push_back(u.back());
      u.pop_back();
      --x;
    }
    if (x != k) cout << -1 << endl;
    else {
      cout << v.size() << endl;
      each (i, v) cout << i.first + 1 << ' ' << i.second + 1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main(void) {
	int n, m, a, b, sum = 0, num = 0, ans = 0;  cin >> n >> m;
	int test[1001] = { 0 };
	for (int h = 0; h < m; h++) {
		cin >> a >> b;
		if (a >= n) {
			sum++;
		}
		else {
			test[num] = n - a;
			num++;
		}
	}
	for (int s = 0; s < num - 1; s++) {
		for (int t = s + 1; t < num; t++) {
			if (test[s] > test[t]) {
				int uio = test[s];
				test[s] = test[t];
				test[t] = uio;
			}
		}
	}
	for (int h = 0; h < m - sum - 1; h++) {
		ans += test[h];
	}
	cout << ans << endl;
	cin >> n;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
string s;
int n,r,g,b;
void solve(){
    cin>>n>>s;
    for(auto i:s){
    	if(i=='R') r++;
    	if(i=='G') g++;
    	if(i=='B') b++;
    }
    int ans=r*g*b;
    rep(i,0,n){
    	rep(j,1,n){
    		int l=i-j;
    		int rr=i+j;
    		if(l>=0 and l<n and rr>=0 and rr<n and s[l]!=s[i] and s[rr]!=s[i] and s[l]!=s[rr]) ans--;
    	}
    }
    cout<<ans<<endl;
}
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#define INF -10000000
int left(int);
int right(int);
int parent(int);
int n;
int main() {

  int i;
  int A[5000];

  

  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&A[i]);

 

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1) printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=n ) printf("left key = %d, ",A[left(i)]);
    if(right(i)<=n) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
 
  return 0;
}

int left(int i)
{
  return 2*i;
}
int right(int i)
{
  return 2*i+1;
}
int parent(int i)
{
  return i/2;
}

Measured memory_bytes: 608
import collections
n,k=map(int,input().split())
a=[int(i) for i in input().split()]

c=collections.Counter(a)
l=[]

for i,j in c.most_common():
    l.append(j)

l.sort()
l.reverse()
ans=n


for i in range(k):
    ans-=l[i]
    if ans==0:
        break
print(ans)

Measured memory_bytes: 39296
#include <cstdio>

int main() {
  long long a, b, x;
  scanf("%lld %lld %lld", &a, &b, &x);
  if(a && b)
    printf("%lld\n", b / x - (a - 1) / x);
  else if(!b)
    printf("1\n");
  else
    printf("%lld\n", b / x + 1);
}

Measured memory_bytes: 128
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  FOR(i,1,n+1){
    c = 0;
    FOR(j,1,i+1){
      if(i%j==0) c++;
    }
    if(i%2==1 && c==8) z++;
  }
  OUT(z);
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
#include <string.h>
int main()
{
    int i,flag,flag1;
    char s[10000];
    while(~scanf("%s",s))
    {
        flag=0;
        flag1=0;
        if(s[0]=='A'&&'a'<=s[1]&&s[1]<='z')
            flag=1;
        if(flag==1)
        {
            for(i=2; i<strlen(s)-1; i++)
                if(s[i]<'a')
                    if(s[i]=='C')
                    {
                        flag1++;
                        if(flag1>1)
                        {
                            break;
                        }
                    }
                    else
                    {
                        printf("WA\n");
                        flag1=10;
                        break;
                    }
            if(flag1==10)
                break;
            if(flag1>1)
                printf("WA\n");
            else if(flag1==1&&s[i]>='a')
                printf("AC\n");
            else
                printf("WA\n");
        }
        else
            printf("WA\n");
    }
    return 0;
}


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

using namespace std;

string s;
int k;
vector<string> v;

int main() {

  cin >> s >> k;

  for (int i = 0; i < s.size(); ++i) {
    for (int j = i; j < s.size() && j - i + 1 <= 10; ++j) {
      v.push_back(s.substr(i, j - i + 1));
    }
  }

  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  
  cout << v[k - 1] << endl;
  
  return 0;
}

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

#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
    return x * fh;
}

void File() {
#ifdef zjp_shadow
	freopen ("f.in", "r", stdin);
	freopen ("f.out", "w", stdout);
#endif
}

const int N = (1 << 16) + 5, Mod = 1e9 + 7;

int n, m;

typedef long long ll;
ll fpm(ll x, int power) {
	ll res = 1;
	for (; power; power >>= 1, (x *= x) %= Mod)
		if (power & 1) (res *= x) %= Mod;
	return res;
}

ll fac[N], ifac[N];

void Init(int maxn) {
	fac[0] = ifac[0] = 1;
	For (i, 1, maxn) fac[i] = fac[i - 1] * i % Mod;
	ifac[maxn] = fpm(fac[maxn], Mod - 2);
	Fordown (i, maxn - 1, 1)
		ifac[i] = ifac[i + 1] * (i + 1) % Mod;
}

ll C(int n, int m) {
	if (n < 0 || m < 0 || n < m) return false;
	return fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}

int maxsta, dp[17][N], a[17];

inline void Add(int &a, int b) { if ((a += b) >= Mod ) a -= Mod; }

int main () {

	File();

	n = read(); m = read();

	Init((maxsta = ((1 << n) - 1)));

	For (i, 1, m) a[i] = read(); reverse(a + 1, a + m + 1);

	dp[0][0] = 1;
	For (i, 0, m - 1) For (sta, 0, maxsta) if (dp[i][sta]) {
		Add(dp[i + 1][sta], dp[i][sta]);
		For (j, 0, n - 1) if (!((sta >> j) & 1))
			Add(dp[i + 1][sta | (1 << j)], 
					dp[i][sta] * fac[1 << j] % Mod * C((1 << n) - sta - a[i + 1], (1 << j) - 1) % Mod);
	}

	int ans = 0;
	For (sta, 0, maxsta) if (dp[m][sta]) {
		(ans += ((__builtin_popcount(sta) & 1) ? -1 : 1) * fac[(1 << n) - sta - 1] * dp[m][sta] % Mod) %= Mod;
		if (ans < 0) ans += Mod;
	}

	printf ("%lld\n", ans * (1ll << n) % Mod);

	return 0;

}


Measured memory_bytes: 4864
use std::io;
use std::collections::HashSet;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let mut a:Vec<i32> = Vec::new();
	for i in 0..n {
		let v:Vec<i32> = procon_read();
		a.push(v[0]);
	}
	let mut i = a[0];
	let mut set = HashSet::new();
	loop {
		if !set.insert(i) {
			println!("-1");
			break;
		}
		if i == 2 {
			println!("{}", set.len());
			break;
		}
		i = a[(i - 1) as usize];
	}
}

Measured memory_bytes: 8444
use proconio::{input,fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
  input!{s: Chars, t: Chars};
  let mut res = 0;
  for (ss, tt) in s.iter().zip(t.iter()) {
    if ss != tt { res +=1; }
  }
  println!("{}", res);
}

Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
*/

ll a,ans=0;

void init(){
	cin>>a;
}

int main(void){
	init();
	if(a<=9){
		ans=a;
	}else if(a<=99){
		ans=9;
	}else if(a<=999){
		ans=9+a-99;
	}else if(a<=9999){
		ans=9+900;
	}else if(a<=99999){
		ans=9+900+a-9999;
	}else if(a<=999999){
		ans=9+900+90000;
	}else if(a<=9999999){
		ans=9+900+90000+a-999999;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a, b, c;
multiset<string>s;
int main()
{
	scanf("%d%d%d", &a, &b, &c);
	for(int i = 1; i <= a; ++i)s.insert("a");
	for(int i = 1; i <= b; ++i)s.insert("b");
	for(int i = 1; i <= c; ++i)s.insert("c");
	while(s.size() > 1)
	{
		string ss = *s.begin() + *--s.end();
		s.erase(s.begin());
		s.erase(--s.end());
		s.insert(ss);
	}
	cout << *s.begin();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N;
int a[100010],b[100010];
ll c[100010];
//無向グラフ作成
vi edge[100010];
ll d[100010];
void add_edge(int from,int to){
  edge[from].pb(to);
  edge[to].pb(from);  
}
void bfs(){
  rep1(i,N) d[i]=INFLL;
  std::queue<int> q;
  q.push(0);
  d[0]=c[N-1];
  int j=1;
  while(!q.empty()){
    int f=q.front();q.pop();
    rep(i,edge[f].size()){
      int ff=edge[f][i];
      if(d[ff]==INFLL){
	d[ff]=0;
	q.push(ff);
	d[ff]=c[N-1-j];
	j++;
      }
    }
  }
}

int main(){
  cin>>N;
  rep(i,N-1){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
  }
  rep(i,N) cin>>c[i];
  std::sort(c,c+N);
  ll M=0;
  rep(i,N-1) M+=c[i];
  rep(i,N-1) add_edge(a[i],b[i]);
  bfs();
  prin(M);
  rep(i,N) std::cout<<d[i]<<" ";
  std::cout<<"\n";
  
  return 0;
}


Measured memory_bytes: 4096
#include <cmath>
#include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>

using namespace std;

int memo[10][10][10][10][51];
int mp[10][10];
int W, H;
int M, Olim, O;

int search(int ny, int nx, int l, int r, int ox)
{
	if (ox <= 0) return (INT_MAX / 2);
	if (ny == H - 1) return (0);
	if (memo[ny][nx][l][r][ox] >= 0) return (memo[ny][nx][l][r][ox]);
	
	int m, o;
	int res = INT_MAX / 2;
	
	if (ox == 1) return (INT_MAX / 2);
	
	if (nx > 0){
		m = o = 0;
		if (l > nx - 1){
			if (mp[ny][nx - 1] < 0) m = -mp[ny][nx - 1];
			else o = mp[ny][nx - 1];
		}
		res = min(res, search(ny, nx - 1, min(l, nx - 1), r, min(Olim, ox + o - 1)) + m);
	}
	
	if (nx < W - 1){
		m = o = 0;
		if (nx + 1 > r){
			if (mp[ny][nx + 1] < 0) m = -mp[ny][nx + 1];
			else o = mp[ny][nx + 1];
		}
		res = min(res, search(ny, nx + 1, l, max(r, nx + 1), min(Olim, ox + o - 1)) + m);
	}
	
	m = o = 0;
	if (mp[ny + 1][nx] < 0) m = -mp[ny + 1][nx];
	else o = mp[ny + 1][nx];
	res = min(res, search(ny + 1, nx, nx, nx, min(Olim, ox + o - 1)) + m);
	
	return (memo[ny][nx][l][r][ox] = res);
}

int main()
{
	while (scanf("%d %d", &W, &H) && W){
		scanf("%d %d %d", &M, &Olim, &O);
		
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				scanf("%d", &mp[i][j]);
			}
		}
		
		int a = INT_MAX / 2;
		
		memset(memo, -1, sizeof(memo));
		for (int i = 0; i < W; i++){
			if (O <= 1) break;
			int m = 0, o = 0;
			if (mp[0][i] < 0) m = -mp[0][i];
			else o = mp[0][i];
			a = min(a, search(0, i, i, i, min(Olim, O + o - 1)) + m);
		}
		
		if (a == INT_MAX / 2 || a > M) printf("NA\n");
		else printf("%d\n", a);
	}
	
	return (0);
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int VS(int n, vector<string> &s, vector<int> &d) {
	d[n]++;
	if (s[n].size() == d[n])
		return n;
	return VS(s[n][d[n]] - 'a', s, d);
}

int main(void) {
	vector<string> s(3), ans = { "A\n", "B\n", "C\n" };
	vector<int> d(3, -1);
	cin >> s[0] >> s[1] >> s[2];
	cout << ans[VS(0, s, d)];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 1010
int x[N],y[N],d[N],vis[2];
inline int read() {
    int x=0,f=1;
    char ch=getchar();
    while (!isdigit(ch)) {
        if (ch=='-') f=-1;
        ch=getchar();
    }
    while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int main() {
    int n=read(),m=0;
    for (int i=1;i<=n;i++) {
        x[i]=read(),y[i]=read();
        vis[(x[i]+y[i])&1]=true;
    }
	if (vis[0]&vis[1]) return puts("-1")&0;
	if (vis[0]) d[++m]=1;
	for (int i=30;i>=0;i--) d[++m]=1<<i;
	printf("%d\n",m);
	for (int i=1;i<=m;i++) printf("%d ",d[i]); putchar('\n');
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=m;j++) {
			if (abs(x[i])>abs(y[i])) {
				if (x[i]>0) x[i]-=d[j],putchar('R');
				else x[i]+=d[j],putchar('L');
			} else {
				if (y[i]>0) y[i]-=d[j],putchar('U');
				else y[i]+=d[j],putchar('D');
			}
		}
        putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define ld long double 
#define float long double 
#define ll long long
#define int long long
#define vl vector<ll> 
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define endl '\n'
#define cnl cout<<endl;
#define pi  3.141592653589793238
#define ms(x,v) ((x), v, sizeof((x)))
#define MAXN 100009
#define CASET int ___T; scanf("%lld", &___T); for(int cs=1; cs <= ___T; cs++)
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
const int N = 200 * 1000 + 9;
const int  inf = 1e18;
const int mod=1e9+7;
int i,j,k;
void solve(){ 
      ll n;  cin >> n;
      vl v(n);
      for(i =0;i < n;i++) cin >> v[i];
        ll mn = 1e18;
        for(i = 0 ; i <= 101;i++){
             ll ans_dis = 0;
               for(j = 0;j < n;j++){
                 int dis = v[j] - i;
                 dis = dis*dis;
                 ans_dis = ans_dis + dis;
               }
               mn =min(mn,ans_dis);
        }
        cout << mn << endl;




    return ;

} 
    signed main(){
   
     //CASET
    solve();
    
   
    return 0;
  }


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n,m,x;
int c[15],a[15][15];
int u[15];
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	}
	int ans=inf;
	for(int i=0;i<2<<n;i++)
	{
		memset(u,0,sizeof(u));
		int sum=0;
		for(int j=1;j<=n;j++)
			if(i>>(j-1)&1)
			{
				sum+=c[j];
				for(int k=1;k<=m;k++)
					u[k]+=a[j][k];
			}
		bool flag=true;
		for(int j=1;j<=m;j++)
			if(u[j]<x)
				flag=false;
		if(flag) ans=min(ans,sum);
	}
	if(ans>=inf) cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3640
#![allow(non_snake_case)]

fn main() {
    let mut S = String::new();
    std::io::stdin().read_line(&mut S).unwrap();
    let ans = match S.trim() {
        "Sunny" => "Cloudy",
        "Cloudy" => "Rainy",
        "Rainy" => "Sunny",
        _ => panic!()
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int mod = 1000000007;
int main() {
    int n, k; cin >> n >> k;
    vector<vector<int>> dp(2001,vector<int>(2001,1));
    rep(i,2000){
        rep(j,2000){
            dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % mod;
        }
    }
    rep(i,k){
        int a = i+1;
        ll ans = 1;
        if (n-k+1 < a){
            cout << 0 << endl;
            continue;
        }
        ans *= dp[a][n-k+1-a];
        ans *= dp[i][k-1-i];
        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 19076
#include<stdio.h>
int main()
{
	int a,b,c;
	int A,B,C;
	scanf("%d%d%d",&a,&b,&c);
	int sum=0;
	int f=0;
	int t=1000;
	while(t--){
		if(a%2!=0||b%2!=0||c%2!=0){
			f=1;
			break;
		}
		A=a;
		a=(b+c)/2;
		B=b;
		b=(A+c)/2;
		C=c;
		c=(A+B)/2;
		sum++;	
	}
	if(f==1) printf("%d\n",sum);
	else printf("-1\n");
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int A,B,N;
    scanf("%d %d",&A,&B);


    if(A > 0 && A< 10  && B>0  && B<10)
    {




        N = A*B;
        printf("%d\n",N);
    }


    else
        printf("-1\n");


return 0;


}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pii              pair <ull,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define ull              unsigned long long
#define f                first
#define s                second
#define sqr(x)           (x)*(x)
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define SZ(a)            (int)a.size()
#define sf(a)            scanf("%d",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%d %d",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define RREP(i,a,b)      for(int i=a;i>=b;i--)
#define intlim           2147483648
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define mk(x1,y1) make_pair(x1, y1)
#define maxl 100010
#define psz 20
using namespace std;
ll n;
ll a[maxl+2];
ll dp[maxl+2];

ll Dp(int pos)
{
    if(pos+1>=n) return 0;
    if(dp[pos] != -1LL) return dp[pos];

    ll ans1=1e18+2,ans2=1e18+2;

    if(pos+1<n) ans1= abs(a[pos]-a[pos+1])+Dp(pos+1);
    if(pos+2<n) ans2= abs(a[pos]-a[pos+2])+Dp(pos+2);

    return dp[pos]=min(ans1,ans2);
  //  cout<<"A  "<<ans1<<"  "<<ans2<<endl;


}
int main()
{
    scanf("%lld",&n);
    memset(dp,-1,sizeof dp);

    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }

    printf("%lld\n",Dp(0));


    return 0;
}

Measured memory_bytes: 4864
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)


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

ans = 1
for i in range(N):
    ans = lcm(ans, T[i])

print(ans)




Measured memory_bytes: 38384
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
#define INF 1e+12
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;

vector<int> v;
vector<int> c;

int main(){
    double r;
    cin >> r;

    double ans = PI * 2 * r;
    printf("%.12lf", ans);
}

Measured memory_bytes: 3784
N = int(input())
*A, = map(int, input().split())
setA = set(A)
if len(setA) == 3:
    a, b, c = list(setA)
    if a ^ c == b and a ^ b == c and b ^ c == a and A.count(a) == A.count(b) == A.count(c): print('Yes')
    else: print('No')
elif len(setA) <= 2:
    maxA = max(setA)
    if A.count(0) == A.count(maxA) or 2*A.count(0) == A.count(maxA): print('Yes')
    else: print('No')
else: print('No')

Measured memory_bytes: 14120
/**
 *    author: mizan
 *    create: 12.01.2019 21:11:00
**/

#include <iostream>

using namespace std;

int main()
{
  int N, H, W;
  cin >> N >> H >> W;
  int ans = (N - H + 1) * (N - W +1);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, fractions, itertools

MOD = 1000000007  # type: int

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

def solve(N: int):
    primes = [n for n in range(1, N+1) if is_prime(n)]
    counter = [0] * len(primes)
    for n in range(2, N+1):
        for i, p in enumerate(primes):
            mod = 0
            c = 0
            r = n
            while(mod == 0):
                mod = r % p
                r /= p
                if mod == 0:
                    c += 1
            counter[i] += c
    res = 1
    for c in counter:
        res *= (c+1)
        res %= MOD
    print(res)
    return 


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5332
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main() {
	auto N = readln().split()[0].to!int();
	int[] h = readln().split().map!(x => x.to!int())().array;
	writeln(solve(h));
}

int solve(int[] h) {
	if (h.length == 0) return 0;
	if (h.length == 1) return h[0];
	
	auto lowest_i = h.length - h.minPos().length, lowest = h[lowest_i];
	h = h.map!(x => x-lowest).array;
	return lowest + solve(h[0..lowest_i]) + solve(h[lowest_i+1 .. $]);
	
}

Measured memory_bytes: 256
#pypyは内包表記使わない, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    k = int(input())
    print(a[k-1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18;
/***********************************************************************/

int32_t main() {
 
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  string s;
  cin >> s;
  int n = SZ(s);
  vector<vector<int>> dp(3, vector<int>(n + 1, -MOD));
  dp[1][1] = 1;
  dp[2][2] = 1;
  for (int i = 2; i <= n; ++i) {
    if (s[i - 1] != s[i - 2]) {
      uax(dp[1][i], dp[1][i - 1] + 1);
    }
    uax(dp[1][i], dp[2][i - 1] + 1);
    uax(dp[2][i], dp[1][i - 2] + 1);
    if (i >= 4 && (s[i - 1] != s[i - 3] || s[i - 2] != s[i - 4])) {
      uax(dp[2][i], dp[2][i - 2] + 1);
    }
  }
  cout << max(dp[1][n], dp[2][n]) << endl;
  
  return 0;
}


Measured memory_bytes: 3732
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

void make_tree(vector<vector<int>> &edges, int now, int p, vector<vector<int>> &children, vector<int> &parent, vector<int> &depth){
    parent[now] = p;
    if(p != -1)
        depth[now] = depth[p] + 1;
    for(auto t: edges[now]){
        if(t == parent[now])
            continue;
        make_tree(edges, t, now, children, parent, depth);
        children[now].push_back(t);
    }
}

int get_longest(int now, vector<vector<int>> &children, vector<int> &parent, vector<int> &longest){
    if(children[now].size() == 0){
        longest[now] = 0;
        return 0;
    }
    if(longest[now] > 0)
        return longest[now];

    for(auto child: children[now]){
        get_longest(child, children, parent, longest);
        longest[now] = max(longest[now], longest[child]);
    }
    longest[now] += 1;
    return longest[now];

}
int main() {
    int n, u, v;
    cin >> n >> u >> v;
    u--, v--;
    vector<vector<int>> edges(n);
    REP(i, n-1){
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    if(u == v){
        cout << 0 << endl;
        return 0;
    }

    vector<vector<int>> children(n);
    vector<int> parent(n);
    vector<int> depth(n, 0);

    make_tree(edges, v, -1, children, parent, depth);

    vector<int> longest(n, 0);
    get_longest(v, children, parent, longest);
    int cango = (depth[u]-1) / 2;

    int dist = depth[u];
    int now = u;

    int ans = 0;
    IFOR(i, 0, cango){
        int dist = depth[u] - 2 * i;
        int tmp = longest[now] + i;
        tmp += dist / 2;
        ans = max(ans, tmp);

        now = parent[now];
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{
    int plugNum, need;
    cin >> plugNum >> need;
    if (2 <= plugNum && plugNum <= 20)
    {
        if (1 <= need && need <= 20)
        {
            int ans = 0;
            for(ans = 1; ;ans++) {
                int counter = (plugNum - 1) * ans + 1;
                if(counter >= need) {
                    break;
                }
            }
            // cout << ans << endl;

            int ans2 = 0;
            int outlet = 1;
            while(outlet < need) {
                --outlet;
                outlet += plugNum;
                ++ans2;
            }
            cout << ans2 << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
string s,t,x;
int a,b; 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s>>t>>a>>b>>x;
	if(x==s)a--;
	else b--;
	cout<<a<<' '<<b;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int d[5];
int a,b,i;
int main(){
	for(i=0;i<3;++i)scanf("%d%d",&a,&b),++d[a],++d[b];
	for(i=1;i<5;++i)if(d[i]==3)break;
	puts(i<5?"NO":"YES");
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int k = fs.nextInt();
		String s = fs.next();
		
		if(s.length() <= k) {
			System.out.println(s);
		}else {
			System.out.println(String.format("%s...", s.substring(0, k)));
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 34140
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = list(input())
ans = 0
commands = ['']*n
for i, t in enumerate(T):
  if t == 'r':
    command = 'p'
    point = p
  elif t == 's':
    command = 'r'
    point = r
  elif t == 'p':
    command = 's'
    point = s
  if (i - k >= 0) and (commands[i-k] == command):
    command = ''
    point = 0
  ans += point
  commands[i] = command
  
print(ans)

Measured memory_bytes: 10536
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v[2];
int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a;
		v[0].push_back(a);
	}
	cin>>m;
	for(i=0;i<m;i++){
		cin>>a;
		v[1].push_back(a);
	}
	sort(v[0].begin(),v[0].end());
	sort(v[1].begin(),v[1].end());
	for(i=0,j=0;i<m;i++){
		while(v[1][i]>v[0][j]){j++;}
		if(v[1][i]<v[0][j])break;
		j++;
	}
	if(i==m)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  string s;
  cin >> s;
  int n = s.size();

  vector<int> a(n+1,0);
  for(int i=0;i<n;i++){
    if(s[i]=='<'){
      a[i+1] = a[i]+1;
    }
  }

  for(int i=n-1;i>=0;i--){
    if(s[i]=='>'){
      int add = a[i+1]+1;
      if(a[i] < add){
        a[i] = add;
      }
    }
  }

  ll sum = 0;
  for(int i=0;i<n+1;i++){
    sum += a[i];
  }

  cout << sum << endl;
}


Measured memory_bytes: 2820
n = int(input())
ans = [0,0,0,0]
for i in range(n):
  s = input()
  if s == "AC":
    ans[0] += 1
  if s == "WA":
    ans[1] += 1
  if s == "TLE":
    ans[2] += 1
  if s == "RE":
    ans[3] += 1
    
print("AC x %d" % ans[0] )
print("WA x %d" % ans[1] )
print("TLE x %d" % ans[2] )
print("RE x %d" % ans[3] )
  
    
    

Measured memory_bytes: 9160
import string
s = input()

if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()

lis =list(string.ascii_lowercase)
nlis = [0]*26

for i in s:
    t = lis.index(i)
    nlis[t] += 1

if sum(nlis) != 26:
    for i in range(26):
        if nlis[i] == 0:
            print(s+lis[i])
            break
else:
    for i in range(25, -1, -1):
        for j in lis:
            if s[i] < j and j not in s[:i]:
                print(s[:i] + j)
                exit()

Measured memory_bytes: 9816
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(),(x).end()
inline cpp_int between(cpp_int n, cpp_int x) {
  if(n >= 0)
    return (n/x)+1;
  else
    return 0;
}

int main () {
  int n,a;
  vector<int> as;
  cin >> n;

  REP(i, n) {
    cin >> a;
    as.push_back(a-1);
  }
  auto current = 0;
  auto c = 0;

  while(true) {
    if(current == 1) {
      cout << c << endl;
      break;
    }
    else if(c >= n) {
      cout << "-1" << endl;
      break;
    }

    c++;
    current = as[current];
  }

  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    sort(a, a+n);
    int s, t;
    s = a[n-1];
    int m = 1001001001;
    rep(i,n-1) {
        if (abs(s - 2*a[i]) < m) {
            t = a[i];
            m = abs(s - 2*a[i]);
        }
    }
    cout << s << " " << t << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<iomanip>

#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define MOD 1000000007

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> k(M);
    vector<vector<int>> s(M);
    int tmp;
    for(int i=0;i<M;i++){
        cin >> k[i];
        for(int j=0;j<k[i];j++){
            cin >> tmp;
            s[i].pb(tmp);
        }
    }
    vector<int> p(M);
    for(int i=0;i<M;i++){
        cin >> p[i];
    }
    int ans=0;
    int cnt=0;
    for(int t=0;t<(1<<N);t++){
        bool flag = true;
        for(int i=0;i<M;i++){
            cnt = 0;
            for(int j=0;j<s[i].size();j++){
                if(t>>(s[i][j]-1)&1){
                    cnt++;
                }
            }
            if(cnt%2!=p[i]){
                flag = false;
            }
        }
        ans+=flag;
    }
    cout << ans << endl;
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
//for set
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   
// for multiset
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;


#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&!(1<<i);}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mul(int a, int b) {return ((a%MOD)*(b%MOD))%MOD;}
int add(int a, int b) {return (a+b)%MOD;}
int sub(int a, int b) {return (((a-b)%MOD)+MOD)%MOD;}
int __div(int a, int b) {return mul(a, powmod(b, MOD-2, MOD));} //if MOD is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
vi order;
bool cmp(int a, int b) {
	return order[a] < order[b];
}
int dfs(int u, vi& trap, vi& a, vi& vis, int* cyc) {
	vis[u]=1;
	if(!vis[a[u]]) {
		dfs(a[u], trap, a, vis, cyc);
	} else if(vis[u]==1 && vis[a[u]]==1) {
		*cyc=u;
	}
	vis[u]=2;
}
int32_t main(void)
{
	IOS;
	int a, b; cin>>a>>b;
	int cnt=0;
	int soc=1;
	while(soc < b) {
		cnt++;
		soc = soc-1+a;
	}
	cout<<cnt<<endl;
	time();
	return 0;
}

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

ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

int main() {

    ll n, m; cin >> n >> m;
    const int INF = 1001001;
    vector<pair<int, int>> key;
    rep(i, m) {
        ll cost, b; cin >> cost >> b;
        ll k = 0;
        rep(j, b) {
            ll c; cin >> c;
            c--;
            k |= (1 << c);
        }
        key.emplace_back(k, cost);
    }

    vector<int> dp(1<<n, INF);
    dp[0] = 0;
    rep(i, 1<<n) {
        rep(j,m) {
            int k = i | key[j].first;
            int cost = dp[i] + key[j].second;
            dp[k] = min(dp[k], cost);
        }
    }

    int ans = dp.back() == INF ? -1 : dp.back();
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,ans=0;cin>>n;
    multiset<ll> st;
    for(ll i=0,x;i<n;i++)cin>>x,st.insert(x);
    while(!st.empty()){
        auto itr= st.end();
        itr--;
        ll val = *itr;
        st.erase(itr);

        ll p=0;
        while(val >= (1ll<<p) )p++;

        ll req = (1ll<<p) - val;

        itr=st.find(req);
        if(itr==st.end())continue;

        ans++;
        st.erase(itr);
    }

    cout<<ans;
}




Measured memory_bytes: 9600
//
//ABC125D-Flipping Signs
//URL-https://atcoder.jp/contests/abc125/tasks/abc125_d
//参考：けんちょんさん
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

#define MAX 100000

int main() {
  ll n;
  ll a[MAX+1];

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

  ll minus = 0;
  ll min = 1LL<<60;
  ll sum = 0;
  for(int i=0; i<n; ++i) {
    if(a[i]<0) ++minus;

    if(min>abs(a[i])) min = abs(a[i]);

    sum += abs(a[i]);
  }

  if(minus%2==0) cout << sum << endl;
  else cout << sum - min*2 << endl; //既にminを一回足しているため

  return 0;
}


Measured memory_bytes: 1024