akhauriyash/Code-Regression huggingface dataset:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = list(input())
    k = int(readline())
    l = len(s)
    rem = k

    for i in range(l):
        char = s[i]
        diff = (ord("z") - ord(s[i]) + 1) % 26
        if rem >= diff:
            rem -= diff
            s[i] = "a"

    rem = rem % 26
    s[l - 1] = chr(ord(s[l - 1]) + rem)
    print("".join(s))


if __name__ == '__main__':
    main()


Measured memory_bytes: 71888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

ll power(ll a, int b) {
  if(!b) return 1;
  ll c = power(a, b/2);
  if(b%2) return c*c%INF*a%INF;
  return c*c%INF;
}

ll factorial(ll a) {
  if(!a) return 1;
  return a*factorial(a-1)%INF;
}

int main() {
  int X,Y;
  cin >> X >> Y;
  
  ll ans=0;
  if((X+Y)%3==0&&X<=2*Y&&Y<=2*X) {
    ll m=(2*Y-X)/3,n=(2*X-Y)/3;
    ans=factorial(m+n)*power(factorial(m),INF-2)%INF*power(factorial(n),INF-2)%INF;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 10624
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

const ll N_MAX=200200;
vector<ll> f(N_MAX,-1);

ll calc(ll num){
        ll tmp=num;
        ll cnt=0;
        if(f[num]!=-1) return f[num];
        if(num==0) return f[num]=0;

        while(tmp>0){
            if(tmp%2==1) cnt++;
            tmp/=2;
        }
        
        ll next=num%cnt;
        ll res=calc(next)+1;
        return f[num]=res;
}

// xのn乗%modを計算
ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll N;
    string X;
    cin>>N;
    cin>>X;
    ll cnt_1=0;
    REP(i,N){
        if(X[i]=='1') cnt_1++;
    }
    ll base1=0;
    ll base2=0;
    ll base3=0;
    if(cnt_1-1>0){
        REP(i,N){
            ll dig=X[i]-'0';
            base1+=dig*mod_pow(2,N-1-i,cnt_1-1);
            base1%=(cnt_1-1);
        }
    }

    if(cnt_1>0){
        REP(i,N){
            ll dig=X[i]-'0';
            base2+=dig*mod_pow(2,N-1-i,cnt_1);
            base2%=cnt_1;
        }
    }

    REP(i,N){
        ll dig=X[i]-'0';
        base3+=dig*mod_pow(2,N-1-i,(cnt_1+1));
        base3%=(cnt_1+1);
    }

    f[0]=0;
    REP2(i,1,200100){
        calc(i);
    }

    REP(i,N){
        if(X[i]=='1'){
            if(cnt_1-1==0){
                cout<<0<<endl;
            }else{
                ll tmp=base1;
                tmp-=mod_pow(2,N-1-i,cnt_1-1);
                tmp%=(cnt_1-1);
                while(tmp<0) tmp+=(cnt_1-1);
                cout<<f[tmp]+1<<endl;
            } 
        }else{
            ll tmp=base3;
            tmp+=mod_pow(2,N-1-i,cnt_1+1);
            tmp%=(cnt_1+1);
            while(tmp<0) tmp+=(cnt_1+1);

            cout<<f[tmp]+1<<endl;
        }
    }
    
    

    
    
    
    
}

Measured memory_bytes: 5188
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second

using namespace std ;

ll N, a, b, c, sum, pre;
ll vc[100001][3], dp[100001][3] ;
int main() {
    cin >> N ;
    for( int i = 0 ; i < N ; i ++ ) {
        cin >> vc[i][1] >> vc[i][2] >> vc[i][3] ;
    }
    for( int i = 1 ; i < N ; i ++ ) {
        vc[i][1] += max(vc[i-1][2], vc[i-1][3] ) ;
        vc[i][2] += max(vc[i-1][3], vc[i-1][1] ) ;
        vc[i][3] += max(vc[i-1][1], vc[i-1][2] ) ;
    }
    cout << max( { vc[N-1][1], vc[N-1][2], vc[N-1][3] } ) << endl;
}


Measured memory_bytes: 2944
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll asc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
ll max(ll x,ll y){return x>y?x:y;}
ll min(ll x,ll y){return x>y?y:x;}

int main(){
    int n,l[2000],r[2000];
    int flg[100000];

    for(int i=0;i<100000;i++)flg[i]=0;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&l[i],&r[i]);
        for(int j=l[i]-1;j<r[i];j++)flg[j]=1;
    }
    int cnt=0;
    for(int i=0;i<100000;i++)if(flg[i])cnt++;

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

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

ll bikkuri(ll x){
    ll ret=1;
    if(x==0){
        return 1;
    }
    else {
        for (int i = 1; i <= x; ++i) {
            ret*=i%mod;
            ret%=mod;
        }
        return ret;
    }
}

int main(){
    ll n,m;cin>>n>>m;
    ll ans;
    ans=bikkuri(n)*bikkuri(m)%mod;
    ans%=mod;
    if(abs(n-m)>1)ans=0;
    if(abs(n-m)==0)ans*=2;
    ans%=mod;
    cout <<ans <<endl;
    return 0;
}



Measured memory_bytes: 256
import math

class KochCurve(object):
	# public変数
	x = 0.0
	y = 0.0

	# private変数
	#__xy = 0.0

	# 解法
	def koch(self, n, a, b):
		if n == 0:
			return 

		s = KochCurve()
		t = KochCurve()
		u = KochCurve()
		th = math.pi * 60.0 / 180.0

		s.x = (2.0 * a.x + 1.0 * b.x) / 3.0
		s.y = (2.0 * a.y + 1.0 * b.y) / 3.0
		t.x = (1.0 * a.x + 2.0 * b.x) / 3.0
		t.y = (1.0 * a.y + 2.0 * b.y) / 3.0
		u.x = (t.x - s.x) * math.cos(th) - (t.y - s.y) * math.sin(th) + s.x
		u.y = (t.x - s.x) * math.sin(th) + (t.y - s.y) * math.cos(th) + s.y
		
		KochCurve().koch(n - 1, a, s)
		msg = "%.8f %.8f" % (s.x, s.y)
		print(msg)
		KochCurve().koch(n - 1, s, u)
		msg = "%.8f %.8f" % (u.x, u.y)
		print(msg)
		KochCurve().koch(n - 1, u, t)
		msg = "%.8f %.8f" % (t.x, t.y)
		print(msg)
		KochCurve().koch(n - 1, t, b)


if __name__ == '__main__':
	a = KochCurve()
	b = KochCurve()

	n = int(input())

	a.x = 0
	a.y = 0
	b.x = 100
	b.y = 0

	msg = "%.8f %.8f" % (a.x, a.y)
	print(msg)
	KochCurve().koch(n, a, b)
	msg = "%.8f %.8f" % (b.x, b.y)
	print(msg)


Measured memory_bytes: 5760
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

const P: u64 = 1000000007;

fn main() {
    let n = get!(usize);
    let s1 = get!(String).chars().collect::<Vec<_>>();
    let s2 = get!(String).chars().collect::<Vec<_>>();

    let mut r;
    let mut i: usize;
    if s1[0] == s2[0] {
        r = 3;
        i = 1;
    } else {
        r = 6;
        i = 2;
    }
    while i < n {
        if s1[i] == s2[i] {
            if s1[i-1] == s2[i-1] {
                r *= 2;
                r %= P;
            }
            i += 1;
        } else {
            if s1[i-1] == s2[i-1] {
                r *= 2;
                r %= P;
            } else {
                r *= 3;
                r %= P;
            }
            i += 2;
        }
    }
    println!("{}", r);
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std; typedef long long ll;
const ll maxn=1e5+5;
int main(void) {
    ll n,t; cin>>n>>t;
    ll ans=LLONG_MAX;
    while(n--){
        ll ci,ti; cin>>ci>>ti;
        if(ti <= t){
            ans=min(ans,ci);
        }
    }
    if(ans == LLONG_MAX){
        cout<<"TLE";
    }else{
        cout<<ans;
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/* 
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}

int main()
{
	string x;
	bool f = false;
	while (cin >> x)
	{
		stringstream s;
		string y;
		s << x;
		while (getline(s, y, '.'))
		{
			stringstream ss;
			string z;
			ss << y;
			while (getline(ss, z, ','))
			{
				if (3 <= z.size() && z.size() <= 6)
				{
					cout << (f ? " " : "") << z;
					f = true;
				}
			}
		}
	}
	cout << endl;
}

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

using namespace std;

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

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

#endif

void solve() {
    ll K;
    string S;
    cin >> K >> S;
    if (S.size() > K) {
        rep(i, K) {
            cout << S[i];
        }
        cout << "..." << '\n';
    } else {
        cout << S << '\n';
    }
}

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


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int n,k;cin>>n>>k;
  int ans = 0;
  while(n){
    n/=k;
    ans++;
  }
  print(ans);
  return 0; 
}


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

#define int             long long int
#define ld              long double
#define ff              first
#define ss              second
#define mp              make_pair
#define pb              push_back
#define endl            "\n"

#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpii            vector <pii>
#define mii             map <int, int>
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))


#define M               1000000007
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
	int x = 1;
	while (b)
	{
		if (b & 1) x *= a;
		a *= a;
		b >>= 1;
	}
	return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 2000005;
int dp[N];
int n, k;
int h[N];
int help(int x)
{
	if (x == n) return 0;
	if (dp[x] != -1) return dp[x];
	int final = INT_MAX;

	loop(i, 1, k + 1)
	{
		int ans = 0;
		int ok = 0;
		if (x + i <= n)
		{
			int cost = abs(h[x] - h[x + i]);
			ans = cost + help(x + i);
			ok = 1;
		}
		if (ok == 1) final = min(final, ans);

	}
	return dp[x] = final;
}

void solve()
{

	cin >> n >> k;

	mset(dp, -1);

	loop(i, 1, n + 1) cin >> h[i];

	cout << help(1);
	return;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


	cout << setprecision(9) << fixed;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}


	return 0;
}

Measured memory_bytes: 22656
#include<iostream>
using namespace std;
int main(void) {
  int a, b, c, x;
  int cnt=0;
  cin>>a>>b>>c>>x;
  for(int i=0; i<=a ; i++) {
    for(int j=0; j<=b ; j++) {
      for(int k=0; k<=c ; k++) {
	if(x==500*i+100*j+50*k) {
	  cnt++;
	}
      }
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

void swap(int *x, int *y){
    int *temp = x;
    x = y;
    y = temp;
}

void sort(int a[10005][2], int n){
    rep(i,n){
        rep(j,n){
            if(a[j][1] < a[j + 1][1]){
                swap(a[j][0], a[j + 1][0]);
                swap(a[j][1], a[j + 1][1]);
            }
        }
    }
}

int main(){
    int n,m;
    while(cin >> n >> m, n||m){
        int info[10005][2] = {0};
        rep(i,n){
            cin >> info[i][0] >> info[i][1]; 
        }
        sort(info, n);
        for(int i = 0; m && i - 1 != n; i++){
            if(info[i][1] == 0) continue;
            if(m >= info[i][0]){
                m-=info[i][0];
                info[i][0] = 0;
            }else{
                info[i][0]-=m;
                m = 0;
            }
        }
        long long sum = 0;
        rep(i,n){
            sum+=(info[i][0] * info[i][1]);
        }
        cout << sum << endl;
    }
}

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

int main(){
  int N, K, Q;
  cin >> N >> K >> Q;
  
  vector <int> A(N,K-Q);
  
  for(int i=0; i < Q; i++){
    int winner;
    cin >> winner;
    --winner;
    ++A[winner];
  }

  for(int i=0; i < N; i++){
  	if(A[i] >0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define Left second
#define Right first
class SEGMENTS{
private:
    bool isInclude(int li, int ri, int L, int R){ return (L<=li && ri<=R); }
    
public:
    map<int,int> dat;

    void erase(int l, int r){
        while(true){
            auto it = dat.upper_bound(l);
            if(it==dat.end() || r<=it->Left)break;
            
            int li = it->Left, ri = it->Right;
            dat.erase(it);
            
            if( !isInclude(li,ri,l,r) ){
                if( isInclude(l,r,li,ri) ){
                    if(li!=l) dat[l] = li;
                    if(r!=ri) dat[ri] = r;
                }else{
                    if(li<=l&&l<ri) ri = l;
                    if(l<=li&&li<r) li = r;
                    if(li!=ri) dat[ri] = li;
                }
            }
        }
    }
    
    void insert(int l, int r){
        while(true){
            auto it = dat.upper_bound(l);
            if(it==dat.end() || r<it->Left){
                if(dat.count(l)){
                    dat[r] = dat[l];
                    dat.erase(l);
                }
                else dat[r] = l;
                break;
            }
            
            if( isInclude(it->Left,it->Right,l,r) ) dat.erase(it);
            else{
                l = min(l,it->Left);
                r = max(r,it->Right);
            }
        }
    }
    
    int size(){ return dat.size(); }
    
    void output(){ for(auto e:dat)cout<<e.Left<<" "<<e.Right<<endl;cout<<endl; }
};


int main(){
    int n,t;
    cin>>n>>t;
    SEGMENTS seg;
    rep(i,n){
        int a;
        cin>>a;
        seg.insert(a,a+t);
    }
    int ans = 0;
    for(auto e:seg.dat){
        ans+=e.first-e.second;
    }
    cout<<ans<<endl;
}

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

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

int main(){
int n;
cin>>n;
string S[n];
map<char,ll>m;
rep(i,n){
  cin>>S[i];
  m[S[i][0]]++;
}
char a[5]={'M','A','R','C','H'};
ll count=0;
for(int i=0;i<3;i++){
  for(int j=i+1;j<4;j++){
    for(int k=j+1;k<5;k++){

count+=m[a[i]]*m[a[j]]*m[a[k]];

    }
  }
}


cout<<count<<endl;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int d[N];
  for(int i=0; i<N; i++){
  	cin >> d[i];
  }
  int result=0;
  for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
      result += d[i]*d[j];
    }
  }
  cout << result << endl;
  return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;

const int MAXN = 3500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 18;
const double EPS = 1e-9;
const double PI = 3.1415926535;

double coins[MAXN];
double dp[MAXN][MAXN];

int main() {
    int N;
    double ans = 0;

    cin >> N;
    for(int i = 1; i <= N; i++)
        cin >> coins[i];

    dp[0][0] = 1;
    for(int i = 1; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            dp[i][j] += dp[i - 1][j] * (1 - coins[i]);
            if(j == 0) continue;
            dp[i][j] += dp[i - 1][j - 1] * coins[i];
        }
    }

    for(int j = (N + 1) / 2; j <= N; j++)
        ans += dp[N][j];
    printf("%0.10f\n", ans);

    return 0;
}



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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }

  int ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1]) ||
        (p[i + 1] < p[i] && p[i] < p[i - 1])) {
      ans++;
    }
  }

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


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

int main(void) {
    int X, N;
    int p[100];

    for(int i = 0; i < 100; i++) {
        p[i] = 0;
    }

    scanf("%d %d", &X, &N);
    for(int i = 0; i < N; i++) {
        int tmp;
        scanf("%d", &tmp);
        p[tmp-1] = 1;
    }

    for(int i = 0; i <= 100; i++) {
        if((X-i) == 0) {
            printf("0\n");
            return 0;
        }
        if(p[X-i-1] == 0) {
            printf("%d\n", X-i);
            return 0;
        }
        if((X+i) == 101) {
            printf("101\n");
            return 0;
        }
        if(p[X+i-1] == 0) {
            printf("%d\n", X+i);
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1736
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    from collections import defaultdict
    ac = set()
    wcc = defaultdict(int)
    for pp, ss in zip(p, S):
        if pp in ac:
            continue
        if ss == 'WA':
            wcc[pp] += 1
        else:
            ac.add(pp)
    print(len(ac), sum((c for p, c in wcc.items() if p in ac), 0))


# Generated by 1.1.6 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
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 19732
n,k=map(int,input().split())
d=list(map(int,input().split()))
def kirai(m,l):
  for i in l:
    if str(i) in str(m):return True
  return False
i=n
while True:
  if kirai(i,d):
    i+=1
  else:
    print(i)
    break

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

int main() {
  int n,k,ans;
  cin >> k >> n;
  ans = 0;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if(n <= i+j+k && i+j <= n){
        ans++;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
c0=0
c1=0
c2=0
c3=0
for i in range(n):
    s = input()
    if s=='AC':
        c0+=1
    elif s=='WA':
        c1+=1
    elif s=='TLE':
        c2+=1
    elif s=='RE':
        c3+=1
print('AC x',c0)
print('WA x',c1)
print('TLE x',c2)
print('RE x',c3)


Measured memory_bytes: 9200
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;
    if (b/k - (a-1)/k >= 1) puts("OK");
  	else if (b%k == 0 || a%k == 0) puts("OK"
);    else puts ("NG");
    return 0;
}




Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	string s, t;
	cin >> s >> t;
	int ans = INT_MAX;
	int i = 0, j = 0, n = s.length(), m = t.length();
	for (int i = 0; i <= n - m; i++) {
		string str = s.substr(i, m);
		int diff = 0;
		for (int j = 0; j < m; j++) {
			if (str[j] != t[j])
				diff++;
		}
		ans = min(diff, ans);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double a, b, x;
    long double ans = 0;
    cin >> a >> b >> x;
    if (x/a < a*b/2) {
        ans = atan(a*b*b/2/x);
    }
    else {
        ans = atan(2*b/a - 2*x/a/a/a);
    }
    cout << std::fixed << std::setprecision(20) << ans/2/3.141592653589*360 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <bitset>
#include <queue>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x)*(x)
typedef long long ll;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    a = a*n;
    cout << (a<b?a:b);
    return 0;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self, men):
        self.men = men[:]

    def throw(self, direction):
        if direction == "E":
            pmen = self.men[:]
            self.men[0] = pmen[3]
            self.men[1] = pmen[1]
            self.men[2] = pmen[0]
            self.men[3] = pmen[5]
            self.men[4] = pmen[4]
            self.men[5] = pmen[2]
        elif direction == "W":
            pmen = self.men[:]
            self.men[0] = pmen[2]
            self.men[1] = pmen[1]
            self.men[2] = pmen[5]
            self.men[3] = pmen[0]
            self.men[4] = pmen[4]
            self.men[5] = pmen[3]
        elif direction == "S":
            pmen = self.men[:]
            self.men[0] = pmen[4]
            self.men[1] = pmen[0]
            self.men[2] = pmen[2]
            self.men[3] = pmen[3]
            self.men[4] = pmen[5]
            self.men[5] = pmen[1]
        elif direction == "N":
            pmen = self.men[:]
            self.men[0] = pmen[1]
            self.men[1] = pmen[5]
            self.men[2] = pmen[2]
            self.men[3] = pmen[3]
            self.men[4] = pmen[0]
            self.men[5] = pmen[4]
        elif direction == "C":
            pmen = self.men[:]
            self.men[0] = pmen[0]
            self.men[1] = pmen[2]
            self.men[2] = pmen[4]
            self.men[3] = pmen[1]
            self.men[4] = pmen[3]
            self.men[5] = pmen[5]
        elif direction == "U":
            pmen = self.men[:]
            self.men[0] = pmen[0]
            self.men[1] = pmen[3]
            self.men[2] = pmen[1]
            self.men[3] = pmen[4]
            self.men[4] = pmen[2]
            self.men[5] = pmen[5]

n = int(raw_input())
mens = []
for i in range(n):
    men = map(int,(raw_input()).split(" "))
    mens.append(men)

flag = False

for p in range(n-1):
    for q in range(p+1, n):
        d1 = Dice(mens[p][:])
        d2 = Dice(mens[q][:])

        for i in range(4):
            d1.throw("W")
            for j in range(4):
                d1.throw("S")
                if d1.men == d2.men:
                    flag = True

        for i in range(4):
            d1.throw("C")
            for j in range(4):
                d1.throw("S")
                if d1.men == d2.men:
                    flag = True
if flag:
    print "No"
else:
    print "Yes"

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

int main()
{
  bool flag = false;

  string s, t;
  cin >> s >> t;

  for(int i = 0; i < s.size(); i++){
    int cnt = 0;
    int dummy = i;

    for(int j = 0; j < t.size(); j++){
      if(s[j] == t[dummy++]) cnt++;
      if(dummy == t.size()) dummy  = 0;
    }

    if(cnt == s.size()){
      flag = true;
      break;
    }
  }

  cout << (flag ? "Yes":"No") << endl;

  return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

namespace Printer{
    void print(vector<int> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    void print(vector<vector<int> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};

//--global--//



//----------//

ll calc(ll H, ll W) {
  ll s1, s2, s3;
  ll mxs, mns;
  ll res = LLINF;
  for (int i = 1; i < H; i++) {
    s1 = i * W;
    s2 = (H - i) * (W / 2);
    s3 = (H - i) * (W - (W / 2));
    mxs = max(s1, max(s2, s3));
    mns = min(s1, min(s2, s3));
    res = min(res, mxs - mns);
  }
 
  s1 = (H / 3) * W;
  s2 = (H - (H / 3) * 2) * W;
  res = min(res, abs(s1 - s2));
 
  return res;
}
 
int main() {
  ll H, W;
  cin >> H >> W;
 
  ll ans = min(H, W);
  ans = min(ans, calc(H, W));
  ans = min(ans, calc(W, H));
 
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
N = int(input())

s = 'abcdefghijklmn'

ans = []
def f(t, k, n):
    if n == N:
        ans.append(t)
        return
    for i in range(k+1):
        f(t+s[i], max(k,i+1), n+1)

f('a', 1, 1)

for a in ans:
    print(a)


Measured memory_bytes: 63836
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const LL MOD = 1e9 + 7;
const int N = 2000;
int arr[N + 5];
int q[N + 5];
vector<pair<int,int> > lst;
int occ[N + 5];

void hora(int tc) {
	int n;
	LL k;
	cin>>n>>k;
	for(int i = 0;i < n;i++) {
		int x;
		cin>>x;
		q[i] = x;
		occ[x]++;
		lst.PB({-x, -i});
	}
	sort(lst.begin(), lst.end());
	LL tot = 0;
	LL mul = (k * (k + 1) / 2) % MOD;
	LL mul2 = (k * (k - 1) / 2) % MOD;
	for(int i = 0;i < n;i++) {
		LL w = 0;
		LL s = 0;
		for(int j = -lst[i].SE;j >= 0;j--) w += arr[j];
		for(int j = -lst[i].SE;j < n;j++) if(q[j] != -lst[i].FI) s += arr[j];
		arr[-lst[i].SE]++;
		tot = (tot + mul * w + mul2 * s) % MOD;
	}
	cout<<tot<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int main()
{
    int N; cin >> N;
    vector<int> L(N, 0);
    for(auto &item : L) cin >> item;
    sort(L.begin(), L.end());
    if(accumulate(L.begin(), L.end() - 1, 0) > L[N-1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;


int main()
{
    int k;
    cin>>k;
    char a[200];
    cin>>a;
    int n=strlen(a);
    if(k>=n)
    {
        cout<<a<<endl;
    }
    else
    {
        for(int i=0;i<k;i++)
        {
            cout<<a[i];
        }
        cout<<"...";
    }
    return 0;
}


Measured memory_bytes: 3636
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) {
        cin >> a.at(i);
    }

    int aMax = -1, aMin = 1001;
    rep(i, N) {
        aMax = max(aMax, a.at(i));
        aMin = min(aMin, a.at(i));
    }

    int ans = aMax - aMin;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define gg return 0;
#define pii pair < int, int>
 
using namespace std;
 
const int maxn = 132675;
const int INF = (int)1e9;
 
ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,mx = -INF,l,r;
 
ll x[maxn],y[maxn],x2[maxn],y2[maxn];
 
bool u[maxn], m, f;
 
vector <int> v;
 /*
void forn( int s, int f, int inter){
	for(int i = s; i <= f; i += inter){
		b[i] = i;
	}
}
*/ 
ll ans;
 
ll pref;
 
//vector <int> g[maxn],d[maxn];
 
ll lvlc,lvl[maxn];
/*
void dfs(int v){
	lvlc++;
	lvl[v] = lvlc;
	d[lvl[v]].pb(v);
	u[v] = 1;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(!u[to]){
			dfs(to);
		}
	}
	lvlc--;
}*/

map <int, int> col; 
 
char ch;

string s; 

int main()
{
	cin >> s;
	for(int i = s.size() - 2; i >= 0; --i){
		if(s[i] != s[i + 1]){
			cnt++;
		}
	}
	cout << cnt;
	gg
}

Measured memory_bytes: 2560
import math
A,B,H,M=map(int, input().split())

HM=M/60
H=H+HM

H = H/12*360
M = M/60*360
cos = H-M

cos = math.cos(math.radians(cos))


ans = A**2+B**2-(2*A*B*cos)

print(math.sqrt(ans))

Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;
int main()
  {int K; cin >> K;
  cout << vector<int>{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 - 1] << endl;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> x1 >> y1 >> x2 >> y2;
	// a1 が原点に来るように移動
	x2 -= x1; y2 -= y1;
	// 垂直で反時計回り，内積 0 で x 座標の符号を反転
	x4 = -y2;
	y4 = x2;
	// a3 = a2 + a4
	x3 = x2 + x4;
	y3 = y2 + y4;
	// 移動したのをもとに戻す
	x3 += x1; y3 += y1; x4 += x1; y4 += y1;
	cout << x3 << " " <<  y3 << " " << x4 << " " << y4 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;


int main() {
    int X, N;
    Pint ans = make_pair(999999, 99999);
    cin >> X >> N;
    set<int> A;
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        A.insert(a);
    }
    for (int i = -101; i <= 101; i++){
        if (A.count(i)){
            continue;
        }
        int t = abs(X - i);
        if (t < ans.first){
            ans.first = t;
            ans.second = i;
        }
    }
    cout << ans.second << endl;
}

Measured memory_bytes: 3576
/*
 *  AUTHOR : MANAV PATEl
*/
#include<bits/stdc++.h>
#include<functional>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

namespace fastio
{

	template <class T> istream &operator>>(istream &os, vector<T> & vec)
	{
		for (auto &u : vec)os >> u;
		return os;
	}
	template <class T> ostream &operator<<(ostream &os, const vector<T> & vec)
	{
		for (auto &u : vec)os << u << " ";
		return os;
	}
	template<class T1, class T2> inline istream& operator>>(istream& os, pair<T1, T2>& p)
	{
		return os >> p.first >> p.second;
	}
	template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p)
	{
		return os << p.first << " " << p.second;
	}
	template <class T> ostream &operator<<(ostream &os, set<T> & con)
	{
		for (auto &u : con) os << u << " ";
		return os;
	}
	void re() {}
	template <typename T, typename... args> void re(T& x, args&... tail)
	{
		cin >> x;
		re(tail...);
	}
	void pr() {}
	template <typename T> void pr(const T& x)
	{
		cout << x;
	}
	template <typename T, typename... args> void pr(const T& x, const args&... tail)
	{
		cout << x << " ";
		pr(tail...);
	}
	template <typename... args> void prln(const args&... tail)
	{
		pr(tail...);
		cout << "\n";
	}
}
using namespace fastio;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

int main()
{
	cin.sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	int x, y;
	cin>>x>>y;
	int flag=0, flag1=0, sum=0;
	if(x==1)
	{
		sum+=300000,flag=1;
	}
	else if(x==2)
		sum+=200000;
	else if(x==3)
		sum+=100000;
	if(y==1)
	{
		sum+=300000,flag1=1;
	}
	else if(y==2)
		sum+=200000;
	else if(y==3)
		sum+=100000;
	if(flag && flag1)
	{
		cout<<sum+400000;
	}
	else
		cout<<sum;
	cout<<"\n";
}




Measured memory_bytes: 256
local math_abs = math.abs
local function distance(x1,y1,x2,y2)
    return math_abs(x1 - x2) + math_abs(y1 - y2)
end

local N = io.read("n")

local hints = {}
local hint_nonzero_x, hint_nonzero_y, hint_nonzero_h
for i=1,N do
    local x, y, h = io.read("n", "n", "n")
    hints[i] = {x, y, h}
    if h ~= 0 then
        hint_nonzero_x, hint_nonzero_y, hint_nonzero_h = x, y, h
    end
end

for cx=0,100 do
    for cy=0,100 do
        local h = hint_nonzero_h + distance(cx,cy,hint_nonzero_x,hint_nonzero_y)
        local ok = true
        for i=1,N do
            local hx, hy, hh = table.unpack(hints[i])
            if (h - distance(cx,cy,hx,hy) == hh) or
                (hh == 0 and h - distance(cx,cy,hx,hy) < 0)
            then
            else
                ok = false
                break
            end
        end
        if ok then
            print(table.concat({cx, cy, h}, ' '))
            return
        end
    end
end
    


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());//int型
		int[] v = new int[N];//int型
		int[] c = new int[N];//int型
		for(int i = 0; i < N; i++) {
			v[i] = Integer.parseInt(sc.next());
		}
		for(int i = 0; i < N; i++) {
			c[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		
		int ans = 0;
		for(int i = 0; i <N; i++) {
			if(v[i]>c[i]){
				ans += v[i]-c[i];
			}
		}
		System.out.println(ans);
	}

}


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


const long long INF = 1LL << 60;

int main()
{
    int K;
    cin >> K;
    for(int i =0;i<K;i++){
        printf("%s", "ACL");
    }
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    string a; cin >>a;
    string s; cin >>s;
    string c; cin >>c;

    string t = "";
    t += 'A';
    t += s[0];
    t += 'C';
    cout << t << endl;

    return 0;
}





Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs(nodes, src):
    """ BFS(一般グラフ、重みなし) """
    from collections import deque

    N = len(nodes)
    que = deque([(src, 0)])
    dist = [INF] * N
    dist[src] = 0
    while que:
        u, c = que.popleft()
        for v in nodes[u]:
            if dist[v] != INF:
                continue
            dist[v] = c + 1
            que.append((v, c+1))
    return dist

N, x, y = MAP()
x -= 1; y -= 1

nodes = [[] for i in range(N)]
for i in range(N-1):
    nodes[i].append(i+1)
    nodes[i+1].append(i)
nodes[x].append(y)
nodes[y].append(x)

distx = bfs(nodes, x)
disty = bfs(nodes, y)

G = list2d(N, N, 0)
for i in range(N):
    for j in range(i+1, N):
        G[i][j] = min(j - i, distx[i] + disty[j] + 1, distx[j] + disty[i] + 1)
ans = [0] * N
for i in range(N):
    for j in range(i+1, N):
        ans[G[i][j]] += 1
[print(a) for a in ans[1:]]


Measured memory_bytes: 84004
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9+7;
using P=pair<ll,ll>;
ll gcd(ll a,ll b){//aとbの最大公約数を返す//計算量は0(log(max(a,b))
  if(a%b==0){return b;}
  else{return gcd(b,a%b);}
}
ll lcm(ll a,ll b){//aとbの最小公倍数を返す//計算量は0(log(max(a,b))
  return a*b/gcd(a,b);
}
ll mod_pow(ll x,ll y){//x^yを返す//計算量は0(log(y))
  ll tmp=x,res=1;
  while(y){
    if(y%2){res=res*tmp%MOD;}
    y>>=1;
    tmp=tmp*tmp%MOD;
  }
  return res;
}
ll nature(ll a){//絶対値を返す
  if(a>=0){return(a);}
  else{return(-1*a);}
}
ll prime(ll a){//素数なら1を返す//計算量は0(sqrt(a))
  if(a==2){return 1;}
  else if(a%2==0 || a==1){return 0;}
  for(ll i=3;i*i<=a;i+=2){if(a%i==0){return 0;}}
  return 1;
}
int main(){
  long long N,check=0,maxA=0;
  cin>>N;
  vector<long long> A(0);
  long long lasta=0;
  for(long long i=0;i<N;i++){
    long long a;
    cin>>a;
    if(i>0){
      if(a!=lasta){
        A.push_back(a);
        lasta=a;
        maxA=max(a,maxA);
      }
    }
    else{
      A.push_back(a);
      lasta=a;
      maxA=max(a,maxA);
    }
  }
  //cout<<A.size()<<endl;
  long long count;
  long long money;
  money=1000;
  count=0;
  for(long long i=1;i<(long long)A.size();i++){
    long long a=A.at(i-1);
    if(maxA==a){
      //continue;
    }
    if(a<A.at(i) && money>=a){
      count+=money/a;
      money-=count*a;
    }
    if(i==1){
      if(a>A.at(i)){
        money+=count*a;
        count=0;
      }
    }
    else{
      if(a>A.at(i-2) && a>A.at(i)){
        money+=count*a;
        count=0;
      }
    }
    //cout<<a<<" "<<count<<" "<<money<<endl;
  }
  if(count!=0){
    money+=count*A.at((int)A.size()-1);
  }
  //cout<<A.at((int)A.size()-1)<<" "<<count<<" "<<money<<endl;
  cout<<money<<endl;
}



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

int main(){
  string s;
  cin >> s;
  
  vector<string> a(7);
  a={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  
  int k;
  
  for(int i=0;i<7;i++){
    if(s==a.at(i)){
      k=i;
      break;
    }
  }
  cout << 7-k << endl;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n,p;
    cin >> n >> p;
    
    ll arr[1000010] = {0};
    ll ans = 1;
    if(n == 1) ans = p;
    else {
        for(ll i = 2; i < 1000010; i++){
            while(p % i == 0){
                arr[i]++;
                p /= i;
            }
        }
    }
    
    for(ll i = 2; i < 1000010; i++){
        ll b = arr[i] / n;
        if(b >= 1){
            for(ll j = 0; j < b; j++){
                ans *= i;
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  for (int i = 0; i < N; i++) {
    bool memo = true;
    if (i != N - 1) {  
      if (S.at(i) == S.at(i + 1)) {
        memo = false;
      }    
    }
    if (memo == true) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9552
#include <bits/stdc++.h>
using namespace std;
vector<int> num;
int main(){
	int n, rd, count = 0;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		scanf("%d", &rd);
		num.push_back(rd);
	}
	for(int i = 0; i < n-1; ++i){
		if(num[i] == i+1 && num[i+1] == i+2){
			swap(num[i], num[i+1]);
			count++;
		}
	}
	for(int i = 0; i < n-1; ++i){
		if(num[i] == i+1 || num[i+1] == i+2){
			swap(num[i], num[i+1]);
			count++;
		}
	}
	printf("%d\n", count);
}

Measured memory_bytes: 892
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

a = nin(5)
ans = sum(a)
m = 0
for i in range(5):
    k = abs(a[i] % 10 - 10)
    if k != 10:
        ans += k
        m = max(m, k)
ans -= m
print(ans)

Measured memory_bytes: 3064
N, M = map(int, input().split())
connect_list = [set() for _ in range(N)]    #繋がっているリスト
for _ in range(M):
    A, B = map(int, input().split())
    connect_list[A-1].add(B)
    connect_list[B-1].add(A)

root_list = [0]*N
root_list[0] = "Yes"

for i in list(connect_list[0]):
    root_list[i-1] = 1
now_set = connect_list[0]
while len(now_set) != 0:
    for j in list(now_set):
        for i in list(connect_list[j-1]):
            if root_list[i-1] == 0:
                root_list[i-1] = j
                now_set.add(i)
        now_set.remove(j)

for i in root_list:
    print(i)

Measured memory_bytes: 66480