akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// Rolling Hash
struct RollingHash {
public:
    long long base_1, base_2, mod_1, mod_2;
    vector<long long> hash1, hash2, pow1, pow2;
    RollingHash(string s) : base_1(1013), base_2(1007), 
        mod_1(1000000007), mod_2(1000000009),
        hash1(s.length()+1,0), hash2(s.length()+1,0),
        pow1(s.length()+1,1), pow2(s.length()+1,1) {
            for(int i=0; i<s.length(); i++) {
                hash1[i+1] = (hash1[i]+s[i]) * base_1 % mod_1;
                hash2[i+1] = (hash2[i]+s[i]) * base_2 % mod_2;
                pow1[i+1] = pow1[i] * base_1 % mod_1;
                pow2[i+1] = pow2[i] * base_2 % mod_2;
            }
        }

    // calc str[l,r) hash
    pair<long long, long long> get(int l, int r) {
        long long t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod_1 + mod_1) % mod_1;
        long long t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod_2 + mod_2) % mod_2;
        return make_pair(t1, t2);
    }
};

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

    RollingHash RH(s);
    set<pii> strset;
    int l = 0, r = 0;
    rep(i,0,m) {
        cin >> inp;
        if(inp == "R++") r++;
        if(inp == "R--") r--;
        if(inp == "L++") l++;
        if(inp == "L--") l--;
        pii p = RH.get(l,r+1);
        // printf("l = %lld, r = %lld, get = (%lld, %lld)\n", l, r, p.fr, p.sc);
        strset.insert(p);
    }
    cout << strset.size() << endl;
    return 0;
}

Measured memory_bytes: 31236
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<ll, int> lli;
struct edge { int v; ll w; };

vector<edge> G[100];
ll d1[100], d2[100];

void dijkstra(int n, vector<edge> G[], int s, ll d[]) {
	fill(d, d + n, LONG_MAX); d[s] = 0;
	priority_queue<lli, vector<lli>, greater<lli> > q;
	q.push(lli(0, s));
	while (!q.empty()) {
		lli p = q.top(); q.pop();
		int u = p.second;
		if (p.first > d[u]) continue;
		for (int j = 0; j < G[u].size(); j++) {
			edge e = G[u][j];
			if (d[e.v] > d[u] + e.w) {
				d[e.v] = d[u] + e.w;
				q.push(lli(d[e.v], e.v));
			}
		}
	}
}

int main() {
	for (;;) {
		int n, m; scanf("%d%d", &n, &m);
		if (n == 0) break;
		for (int u = 0; u < n; u++) G[u].clear();
		for (; m > 0; m--) {
			int a, b, c; scanf("%d%d%d", &a, &b, &c);
			edge e1 = {b - 1, c}; G[a - 1].push_back(e1);
			edge e2 = {a - 1, c}; G[b - 1].push_back(e2);
		}
		dijkstra(n, G, 0, d1);
		dijkstra(n, G, n - 1, d2);
		ll ans = LONG_MAX;
		for (int u = 0; u < n; u++)
			for (int i = 0; i < G[u].size(); i++)
				for (int j = 0; j < G[u].size(); j++) {
					ll v1 = G[u][i].v, v2 = G[u][j].v;
					if (d1[v1] == LONG_MAX || d2[v2] == LONG_MAX) continue;
					ans = min(ans, d1[v1] + d2[v2]);
				}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll a = x / 500;
    ll b = (x % 500) / 5;
    cout << a * 1000 + b * 5 << endl;
}


Measured memory_bytes: 256
// D - Widespread
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define rp(i,n) for(int i=0;i<(n);++i)

int main(){
	int N,A,B; cin>>N>>A>>B;
	vector<LL> H(N); rp(i, N) cin>>H[i];

	int ans = 1e9;
	LL ab = (LL)A - B;//additional damage
	int L = 0, R = 1e9;
	while(L <= R){
		int t = (L + R)/2;//mid
		LL tb = (LL)t * B;
		LL s = 0;
		rp(i, N){
			LL h = H[i] - tb;
			if(h > 0) s += (h+ab-1)/ab;
		}
		if(t >= s){
			R = t - 1;//mid-1
			ans = t;
		}
		else L = t + 1;//mid+1
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Scanner str = new Scanner(System.in);

	String S = str.nextLine();
	String[] x = S.split("");
	int n = 0;

	for (int i = 0; i < x.length - 1; i++) {
	    if (x[i].compareTo(x[i + 1]) == 0) {
		n++;
	    }
	}

	if (n > 0) {
	    System.out.println("Bad");
	} else {
	    System.out.println("Good");
	}
    }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  string N; cin >> N;
  
  int n = 0;
  for(char c : N) {
    n += c - '0';
  }
  
  if(n%9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

const int MOD = pow(10,9)+7;
typedef long long ll;

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

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



int isPrime(int x){
    
    int g = (int)sqrt(x);
    
    for(auto j = 2; j<=g; j++){
        
        if (x % j == 0){
            return 0;
        }
    }
    
    return 1;
}


int main() {
  
    ll x = lin();
    
    ll  ans = (x/11) * 2;
    
    x %= 11;
    
    ans += (x+5)/6;
//
//    if (x != 0){
//        if ( x > 0 && x <= 5){
//            ans++;
//        }else if (x >= 6 && x < 11){
//            ans +=2;
//        }
//    }
//
    cout << ans << endl;
    
    return 0;
    
}





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

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

  vector<ll> s(m), c(m);
  for (ll i = 0; i < m; i++) {
    cin >> s[i] >> c[i];
  }

  for (ll i = 0; i < 1000; i++) {
    string str = to_string(i);
    if ((ll) str.size() != n) continue;
    bool ok = true;
    for (ll j = 0; j < m; j++) {
      if (str[s[j] - 1] - '0' != c[j]) ok = false;
    }
    if (ok) {
      cout << str << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


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

int main(){
    long long k;
    cin >> k;
    if (k == 0) {
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
        exit(0);
    }
    if (k == 1) {
        cout << 2 << endl;
        cout << 0 << " " << 2 << endl;
        exit(0);
    }

    cout << 50 << endl;
    long long ans = (k + 50) / 50 + 50 - 1;
    long long num = (k + 50) / 50 * 50;
    for (int j = 0; j < 50; j++){
        if (j < num - k) cout << ans - (50 - (num - k)) - 1;
        else cout << ans + (num - k);
        if (j != 49) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	vector<string> a(n);
	rep(i,n) cin >> a[i];
	rrep(i,1,n) {
		if(a[i-1][a[i-1].size()-1]!=a[i][0]) {
			cout << "No" << endl;
			return 0;
		}
		for(int j=i-1;j>=0;j--) {
			if(a[i]==a[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

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

int main(){
    ll N;
    cin>>N;
    ll sum = 0;
    rep(i,N+1){
        if(i%3==0 || i%5==0) continue;
        sum+=i;
    }
    cout<<sum<<endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
 
using namespace std;
int a, b = 0;
bool ans = false;
int main() {
    cin >> a >> b;
    if (a <= 8) {
        if (b <= 8) {
            ans = true;
        }
    }
    if (ans == true)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  cout << max(A*B,C*D) << endl;
  return 0;
}

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

int main(int argc, char const *argv[]) {
    int n, m, l;
    cin >> n >> m >> l;

    int A[n][m];
    int B[m][l];
    long long C[n][l];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++) {
            cin >> B[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            C[i][j] = 0;
            for (int k = 0; k < m; k++) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            if (j) {
                cout << " ";
            }
            cout << C[i][j];
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define ri register int
using namespace std;
typedef long long ll;
const int rlen=1<<18|1;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  char ch=gc();
  while(!isdigit(ch)) ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return ans;
}
namespace modular {
  const int mod=998244353;
  inline int add(int a,int b) { return a+b<mod?a+b:a+b-mod; }
  inline int  dec(int a,int b) { return a<b?a-b+mod:a-b; }
  inline int mul(int a,int b) { return (ll)a*b%mod; }
  inline void Add(int&a,int b) { a=a+b<mod?a+b:a+b-mod; }
  inline void Dec(int&a,int b) { a=a<b?a-b+mod:a-b; }
  inline void Mul(int&a,int b) { a=(ll)a*b%mod; }
}
using namespace modular;
const int N=405;
int n,a[N],pw[N],fac[N],ifac[N];
inline int C(int n,int m) { return n<m||m<0?0:mul(fac[n],mul(ifac[m],ifac[n-m])); }
inline void init() {
  fac[0]=fac[1]=ifac[0]=ifac[1]=pw[0]=1,pw[1]=2;
  for(ri i=2;i<=n;++i) {
    pw[i]=add(pw[i-1],pw[i-1]);
    fac[i]=mul(fac[i-1],i);
    ifac[i]=mul(ifac[mod-mod/i*i],mod-mod/i);
  }
  for(ri i=2;i<=n;++i) Mul(ifac[i],ifac[i-1]);
}
int idx[N][N],f[N<<1][N][N][2],tot=0;
inline int dfs(int l,int r,int ht) {
  if(l>r) return f[0][ht][0][0]=f[0][ht][0][1]=1,0;
  int ret=idx[l][r]?idx[l][r]:(idx[l][r]=++tot);
  int mn=0x3f3f3f3f,ps=0;
  for(ri i=l;i<=r;++i) if(a[i]<mn) mn=a[i],ps=i;
  if(mn==ht) {
    int L=dfs(l,ps-1,ht),R=dfs(ps+1,r,ht),len1=ps-l,len2=r-ps;
    for(ri i=0;i<=len1;++i) for(ri j=0;j<=len2;++j) for(ri op=0;op<2;++op)
    Add(f[ret][ht][i+j+op][op],mul(f[L][ht][i][op],f[R][ht][j][op]));
  }
  else {
    dfs(l,r,ht+1);
    int len=r-l+1;
    for(ri i=0;i<=len;++i) for(ri op=0;op<2;++op) {
      Add(f[ret][ht][i][op],f[ret][ht+1][i][1]);
      Add(f[ret][ht][i][op],mul(f[ret][ht+1][i][op],dec(pw[len-i],1)));
    }
    for(ri i=1;i<=len;++i) for(ri j=1;j<=i;++j) for(ri op=0;op<2;++op)
    Add(f[ret][ht][i-j][op],mul(f[ret][ht+1][i][op],mul(pw[len-i],C(i,j))));
  }
  return ret;
}
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  n=read();
  init();
  for(ri i=1;i<=n;++i) a[i]=read();
  cout<<f[dfs(1,n,0)][0][0][0];
  return 0;
}

Measured memory_bytes: 515840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int main()
{
  int N;
  char  S[101];
  bool res = true;
  cin >> N;
  cin >> S;

  if (N%2 == 1) {
    res = false;
  }
  else {
    rep(i,N/2) {
      if( S[i] != S[i+N/2]) res = false;
    }
  }
  if (res) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
if __name__ == "__main__":

    X, Y, A, B, C = map(int, input().split())

    Red = list(map(int, input().split()))
    Red.sort()
    Red = Red[::-1]
    Red = Red[:X]
    Green = list(map(int, input().split()))
    Green.sort()
    Green = Green[::-1]
    Green = Green[:Y]
    NoColor = list(map(int, input().split()))

    A = Red + Green + NoColor
    # print(A)
    A.sort(reverse=True)

    eaten = A[:X+Y]

    print(sum(eaten))


Measured memory_bytes: 106348
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <string>

using namespace std;
typedef long long ll;

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

int main() {

    ll N;
    cin >> N;
    ll M = 1;
    rep(i,N) M *= i+1;
    ll P[N];
    ll Q[N];
    rep(i,N) cin >> P[i];
    rep(i,N) cin >> Q[i];
    ll p = 0;
    ll q = 0;
    rep(i,N){
        p += P[i]*pow(10,N-1-i);
        q += Q[i]*pow(10,N-1-i);
    }
    ll S[N];
    rep(i,N) S[i] = i+1;
    ll T[M];
    rep(i,M) T[i] = 0;
    ll j = 0;
    do {
        rep(i,N) T[j] += S[i]*(ll)pow(10,N-1-i);
        j++;
    } while(next_permutation(S, S+N));
    ll X,Y;
    rep(i,M){
        if(T[i]==p) X = i;
        if(T[i]==q) Y = i;
    }
    cout << abs(Y-X) << endl;
    return 0;
}


Measured memory_bytes: 512
/*

Bismillah_hir_rahmanir_rahim

*/
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define inf ( ll  )( 1e18 + 100 )
#define bug cout <<"--------------------------\n"


///int dx[] = {0, 0, -1, +1}, dy[] = {-1, +1, 0, 0}; //4 Direction Array

///int dx[] = {0, 0, -1, +1, -1, -1, +1, +1}, dy[] = {-1, +1, 0, 0, -1, +1, -1, +1}; //8 Direction Array

///int dx[] = {-2, -2, -1, -1, +1, +1, +2, +2}, dy[] = {-1, +1, -2, +2, -2, +2, -1, +1}; //Knight Moves

///int dx[]={-1,-1,+0,+1,+1,+0};int dy[]={-1,+1,+2,+1,-1,-2}; ///Hexagonal Direction


ll bag, items ;

const ll maxn = 100+4;

ll weight[maxn];
ll values[maxn];

ll dp[maxn][100000+4];

ll KNAPSACK( ll jinish, ll tot )
{
    if ( jinish ==  items+1 )
        return 0;


    if(dp[jinish][tot] != -1)
    {
        return dp[jinish][tot];
    }
    else
    {

        ll res1 = 0;
        res1 = KNAPSACK(jinish + 1, tot);
        /// na nile

        ll res2 =  0;
        if( tot - weight[jinish] >= 0 )
        {
            res2 = KNAPSACK( jinish + 1, tot - weight[jinish] ) + values[jinish];
        }
        /// nile

        return   dp[jinish][tot]  = max( res1, res2 );
    }
}

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

    // freopen("input.txt", "r", stdin);




    while ( cin >>items   >> bag )
    {
        memset(dp,-1,sizeof dp);


        for(ll i = 1 ; i<=items ; i++)
        {
            cin >> weight[i];
            cin >> values[i];
        }
        cout << KNAPSACK(1, bag) <<endl;
    }
    return 0;
}



Measured memory_bytes: 81536
#include<iostream>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	for(int i=0;s[i];i++){
		if(!i)cout<<char(s[i]-32);
		else if(s[i]==' ')cout<<char(s[i+1]-32);
	}
	cout<<endl;
}

Measured memory_bytes: 256
input = readlines()

n = input.shift.chomp.to_i
al = input.shift.chomp.split("\s").map{|x| x.to_i}
bl = input.shift.chomp.split("\s").map{|x| x.to_i}
cl = input.shift.chomp.split("\s").map{|x| x.to_i}

sum = 0
al.each_with_index do |d, i|
  di = d - 1
  sum += bl[di]
  if i > 0 && d == al[i - 1] + 1
    sum += cl[di - 1]
  end
end

puts sum

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

typedef long long ll;
#define re(n) cin >> n
#define all(a) a.begin(),a.end()
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define te(t) ll t; re(t); while(t--)

int main(){
	ll a, b;
	re(a >> b);
	if(a<10&&b<10) cout << a*b << endl;
	else cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
n,q = map(int,input().split())
tree = [set() for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].add(b-1)
    tree[b-1].add(a-1)
count = [0]*n
for _ in range(q):
    p,x = map(int,input().split())
    count[p-1] += x
    
stack = [[0,0,-1]] # [number,count,pair]
while stack:
    num,cnt,pr = stack.pop()
    count[num] += cnt
    for k in tree[num]:
        if k == pr:
            continue
        stack.append([k,count[num],num])
        
print(*count)

Measured memory_bytes: 98472
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a = input::<String>();
    let b = input::<String>();
    let c = input::<String>();
    println!(
        "{}{}{}",
        a.chars().next().unwrap().to_uppercase().next().unwrap(),
        b.chars().next().unwrap().to_uppercase().next().unwrap(),
        c.chars().next().unwrap().to_uppercase().next().unwrap(),
    );
}

Measured memory_bytes: 4352
import fractions
K = int(input())
out = 0
L = [0]*K
gcd = [[0]*K for i in range(K)]
for i in range(1,K+1):
    for j in range(1,K+1):
        A = fractions.gcd(i,j)
        gcd[i-1][j-1] = A
        L[A-1]+=1


for i in range(1,K+1):
    for j in range(1,K+1):
        out+=gcd[i-1][j-1]*L[j-1]

print(out)

Measured memory_bytes: 10872
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

long iwakan[35][35] = { 0 };
unordered_map<long, unordered_map<long, long> > foo;
unordered_map<long, unordered_map<long, long> > bar;

void solve() {
  long N, C;
  cin >> N >> C;
  rep (i, C) rep (j, C) {
    cin >> iwakan[i+1][j+1];
  }
  rep (i, N) rep (j, N) {
    long c;
    cin >> c;
    foo[(i+j)%3][c]++;
  }
  for (long i = 1; i <= C; i++) {
    for (auto it: foo[0]) bar[0][i] += iwakan[it.first][i] * it.second;
    for (auto it: foo[1]) bar[1][i] += iwakan[it.first][i] * it.second;
    for (auto it: foo[2]) bar[2][i] += iwakan[it.first][i] * it.second;
  }
  long ans = bar[0][1] + bar[1][2] + bar[2][3];
  for (long a = 1; a <= C; a++) {
    for (long b = 1; b <= C; b++) {
      if (a == b) continue;
      for (long c = 1; c <= C; c++) {
        if (b == c or c == a) continue;
        long tmp = bar[0][a] + bar[1][b] + bar[2][c];
        ans = min(ans, tmp);
      }
    }
  }
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

int main(void){
    ll k, x;
    cin >> k >> x;
    FOR(i,x-k+1,x+k-1){
        cout << i << " ";
    }
}

Measured memory_bytes: 256
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let h1 = +cin.shift();
    let m1 = +cin.shift();
    let h2 = +cin.shift();
    let m2 = +cin.shift();
    let k = +cin.shift();
    let d = (h2-h1)*60+(m2 - m1) -k;
    console.log(d);
}
main();


Measured memory_bytes: 29632
def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)
def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)

n = int(input())
t = [int(input()) for _ in range(n)]

ans = t[0]
if n > 1:
    ans = LCM(t[0], t[1])
    for i in range(2, n):
        ans = LCM(ans, t[i])

print(ans)


Measured memory_bytes: 3064
#include <cstdio>
using namespace std;
int main()
{
         int i,n,a[201],flag=0,count=0;
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
                 scanf("%d",&a[i]);
        }
       while(flag!=1)
        {
                 for(i=0;i<n;i++)
                 {
                           if(a[i]%2==0)
                                       a[i]/=2;
                           else
                                       flag=1;
                 }
                 if(flag==0)
                 {
                             count++;
                 }
        }
        printf("%d",count);
        return 0;
}

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

int main(){

  int K, S, ans=0;
  int sum;
  cin >> K >> S;

  for(int i=0; i<=K && i<=S; i++){
    for(int j=0; j<=K && j<=S; j++){
      sum = i+j;
      if(S-sum>=0){
        if(S-sum<=K){
          ans++;
        }else{
          continue;
        }
      }else{
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef unsigned long long ull;

const int N = int(5e5) + 5;
const int inf = (int)1e9 + 7;

# define int long long

int n, m;
int a[N], dist[N];
ll ans[N];
ll sum;

int c1[N], c2[N], c3[N];
ll t1[N], t2[N], t3[N];

void add(int v, int val){
  for(; v < N; v += v & -v){
    c1[v] += (val > 0 ? 1 : -1);
    t1[v] += val;
  }
}

void add2(int v, int val){
  for(; v < N; v += v & -v){
    c2[v] += (val > 0 ? 1 : -1);
    t2[v] += val;
  }
}

pair < ll, ll > get1(int v){
  pair < ll, ll > ans;
  for(; v > 0; v -= v & -v){
    ans.first += c1[v];
    ans.second += t1[v];
  }
  return ans;
}

pair < ll, ll > get2(int v){
  pair < ll, ll > ans;
  for(; v > 0; v -= v & -v){
    ans.first += c2[v];
    ans.second += t2[v];
  }
  return ans;
}


main(){
  scanf("%lld %lld", &n, &m);
  for(int i = 1; i <= n; ++i){
    scanf("%lld", a + i);
  }
  /// when optimal
  /// a[i] < fav <= a[i + 1]
  /// 1 + a[i + 1] - fav - a[i + 1] + a[i]
  /// 1 - fav + a[i]
  /// a[i] > a[i + 1] && fav <= a[i + 1]
  /// 1 + a[i + 1] - fav - a[i + 1] + a[i] - m
  /// 1 - fav + a[i] - m
  /// 1 + (a[i + 1] - fav + m) - (a[i + 1] - a[i] + m)
  /// 1 - fav + a[i]

  for(int i = 1; i < n; ++i){
    assert(a[i] != a[i + 1]);
    if(a[i] < a[i + 1]){
      dist[i] = a[i + 1] - a[i];
      add(a[i] + 1, a[i]);
      add(a[i + 1] + 1, -a[i]);
    } else{
      dist[i] = a[i + 1] - a[i] + m;
      add2(1, a[i]);
      add2(a[i + 1] + 1, -a[i]);
      add(a[i] + 1, a[i]);
    }
    sum += dist[i];
  }
  ll wow = (ll)(1e18);
  for(int i = 1; i <= m; ++i){
    pair < ll, ll > e = get1(i);
    ans[i] = e.first - e.first * i + e.second;
    e = get2(i);
    ans[i] += e.first - e.first * i + e.second - m * e.first;
  //  printf("%lld\n", ans[i] + sum);
    wow = min(wow, ans[i] + sum);
  }
  printf("%lld", wow);
  return 0;
}


Measured memory_bytes: 22784
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    
    map<string,ll> mp;
    ll ans = 0;
    string tmp;
    
    for(int i=0;i<N;i++){
        cin >> tmp;
        sort(tmp.begin(),tmp.end());
        ans += mp[tmp];
        mp[tmp]++;
    }
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 11136
import sys

sys.setrecursionlimit(1000000)

MOD = 10 ** 9 + 7

n = int(input())

ab = [[] for _ in range(n)]

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

def treeDP(p):
    if len(ab[p]) == 0:
        return [2,1]
    else:
        f = 1
        g = 1
        for x in ab[p]:
            ab[x].remove(p)
            temp = treeDP(x)
            f *= temp[1]
            g *= temp[0]
        f += g
        return [f % MOD, g % MOD]

print(treeDP(0)[0])


Measured memory_bytes: 99760
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	m := iScan()
	x := iScan()
	a := make(map[int]int)
	for i := 0; i < m; i++ {
		a[iScan()-1] = 1
	}
	p, q := 0, 0
	for i := 0; i < x; i++ {
		p += a[i]
	}
	for i := x; i < n; i++ {
		q += a[i]
	}
	fmt.Println(smaller(p, q))
}


Measured memory_bytes: 1788
#include<iostream>
using namespace std;
#define int long long int
#define inf 1000000000000000000
int32_t main()
{
	int a,b;
	cin>>a>>b;
	if(a>0)
	   cout<<"Positive"<<endl;
	else if(b<0)
	{
		int x=b-a+1;
		if(x%2==0)
		   cout<<"Positive"<<endl;
		else
		    cout<<"Negative"<<endl;
	}
	else
	    cout<<"Zero"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

ll fac[100000+1],si[100000+1],a[100000],ans,n;

ll mpow(ll x,ll n){
    ll res = 1;
    while(n != 0){
        if(n&1) res = res*x % mod;
        x = x*x % mod;
        n = n >> 1; 
    }
    return res;
}
void calc_fac(){
   fac[0] = 1;
   si[0] = 0;
   for(int i = 0;i < 100000;i ++){
       fac[i+1] = fac[i]*(i+1) % mod;
       si[i+1] = (si[i]+mpow(i+1,mod-2)) % mod;
   }
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i ++){
        cin >> a[i];
    }
    calc_fac();
    for(int j = 0;j < n;j ++){
        ans += (si[n-j]+si[j+1]-1)%mod*a[j];
        ans %= mod;
    }
    ans *= fac[n];
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 2560
while True:
    try:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
        if abs((yb - ya) * (yd - yc) + (xb - xa) * (xd - xc)) <= 1e-11 :
            print('YES')
        else:
            print('NO')

    except EOFError:
        break


Measured memory_bytes: 5580
#include<iostream>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    string s;
    int cnt[26]={};
    char ch='a';
    while(getline(cin,s)){
        int size=s.size();
        F(i,0,size) if(s[i]>='A' && s[i]<='Z') s[i]=s[i]-'A'+'a';
        F(i,0,size){
            F(j,0,26){
                if(s[i]-'a'==j){
                    ++cnt[s[i]-'a'];
                    break;
                }
            }
        }
    }
    F(i,0,26){
        cout << ch << " : " << cnt[i] << endl;
        ++ch;
    }
    return 0;
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)

int main(){
    int N, x,a,b,c;
    cin >> N;
    a = N/100;
    b = N%100/10;
    c = N%10;
    while(N<1000){
        if(a == b && b == c){
            cout << N << endl;
            return 0;
        }
        else{
            N++;
            a = N/100;
            b = N%100/10;
            c = N%10;
        }
    }
    return 0;
}

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

vector<pair<long long, long long>> prime_factorize(long long N) {
  vector<pair<long long, long long>> res;
  for (long long a = 2; a * a <= N; a++) {
    if (N % a != 0) continue;
    long long ex = 0;
    while (N % a == 0) {
      ex++;
      N /= a;
    }
    res.push_back({a, ex});
  }
  if (N != 1) res.push_back({N, 1});
  return res;
}

int main() {
  long long N;
  cin >> N;

  const int MOD = 1000000007;
  vector<long long> ex(N + 1, 0);
  for (long long n = 2; n <= N; n++) {
    const auto &res = prime_factorize(n);
    for (auto p : res) ex[p.first] += p.second;
  }
  long long res = 1;
  for (int p = 2; p <= N; p++) {
    res *= ex[p] + 1;
    res %= MOD;
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int r,g,b;

    scanf("%d %d %d",&r,&g,&b);

    if(((100*r)+(10*g)+b)%4==0){
        printf("YES");
    }

    else
    {
        printf("NO");
    }
    
    
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

string solve(int na, int nb, int nc) {
	if (na == 0 && nb == 0 && nc == 0) return "";
	if (na == 0) { string ret = solve(nb, nc, 0); REPSZ(i, ret) ++ret[i]; return ret; }
	vector<string> parts;
	string cur = "a"; int curcnt = na; na = 0;
	while (na+nb+nc>0) {
		if (nc >= curcnt) { cur += "c"; nc -= curcnt; continue; }
		while (nc > 0) parts.PB(cur + "c"), --curcnt, --nc;
		if (nb >= curcnt) { cur += "b"; nb -= curcnt; continue; }
		while (nb > 0) parts.PB(cur + "b"), --curcnt, --nb;
	}
	while (SZ(parts) > 0) {
		int rep = curcnt / SZ(parts), rem = curcnt%SZ(parts); if (rem == 0) --rep, rem = SZ(parts);
		string pref; REP(i, rep) pref += cur; string nxt = pref + cur + parts[rem - 1];
		int nxtcnt = 1; while (nxtcnt < rem&&parts[rem - 1] == parts[rem - 1 - nxtcnt]) ++nxtcnt;
		vector<string> nparts; FORSZ(i, rem, parts) nparts.PB(pref + parts[i]); REP(i, rem - nxtcnt) nparts.PB(pref + cur + parts[i]);
		parts = nparts; cur = nxt; curcnt = nxtcnt;
	}
	string ret; REP(i, curcnt) ret += cur; return ret;
}

void run() {
	int na, nb, nc;
	scanf("%d%d%d", &na, &nb, &nc);
	string s = solve(na, nb, nc);
	printf("%s\n", s.c_str());
}

string other(int a,int b,int c) {
	multiset<string> s;
	while (a--) s.insert("a");
	while (b--) s.insert("b");
	while (c--) s.insert("c");
	while ((int)s.size() > 1) {
		string t = *s.begin() + *--s.end();
		s.erase(s.begin());
		s.erase(--s.end());
		s.insert(t);
	}
	return *s.begin();
}

int main() {
	run();
	return 0;
}


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

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

	int N;
	cin >> N;

	vector<int> H( N );
	for( auto& v: H ) { cin >> v; }

	int result = 0;
	vector<int> s( N );

	for( int i = 1; i < N; ++i ) {
		if( H.at( i ) <= H.at( i-1 ) ) {
			s.at( i ) = s.at( i-1 ) + 1;
			result = max( result, s.at( i ) );
		}
	}

	cout << result << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int A,B; cin>>A>>B;

    int minN=B*10,maxN=(B+1)*10,ans=-1;
    rep(i,minN,maxN) if(floor(i*0.08)==A){ans=i;break;}

    cout<<ans<<endl;
}

Measured memory_bytes: 256
n = input()
vList = list(map(int, input().split()))
vList.sort()
s = sum(vList)
while len(vList) > 1:
    t = (vList[0] + vList[1]) / 2
    vList.pop(0)
    vList[0] = t
    s -= t
print(vList[0])

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


// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef complex<int> ci;
typedef complex<double> cd;
typedef complex<long double> cld;

// macros
#define rep(i, a, b) for(int i=a; i<b; i++)
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define tr(c, it) for(auto it=(c).begin(); it!=c.end(); it++)
#define pb push_back
#define mp make_pair
#define bitcount __builtin_popcount
#define ispresent(c, x) ((c).find(x) != (c).end())
#define watch(x) cout<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// template functions
template <typename T>
inline void printV(vector<T>& a) { rep(i, 0, sz(a)) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printV(vector<T>& a, int n) { rep(i, 0, n) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a)
{
	rep(i, 0, sz(a)) {
		printV(a[i]);
	}
	cout<<"\n";
}

template <typename T>
inline void clearVV(vector<vector<T>>& a)
{
	for(auto& x:a) {
		x.clear();
	}
	a.clear();
}
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val)
{
	for(int i=0; i<sz(a); i++) {
		for(int j=0; j<sz(a[i]); j++) {
			a[i][j]=val;
		}
	}
}


// constants
const long double eps = 1e-9;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;

inline int add(int a, int b)
{
	return ((ll)a+b+modn)%modn;
}

inline int mul(int a, int b)
{
	return ((ll)a*b)%modn;
}

void matmul(vector<vector<int>> &a, vector<vector<int>> &b)
{
	int n=a.size();
	vector<vector<int>> c(n, vector<int>(n));
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			for(int k=0; k<n; k++) {
				c[i][j]=add(c[i][j], mul(a[i][k], b[k][j]));
			}
		}
	}
	a=c;
}

void po(vector<vector<int>> &adj, ll k)
{
	int n=adj.size();
	vector<vector<int>> res(n, vector<int>(n));
	for(int i=0; i<n; i++) {
		res[i][i]=1;
	}
	while(k) {
		if(k&1) {
			matmul(res, adj);
		}
		matmul(adj, adj);
		k>>=1;
	}
	adj=res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	int n;
	ll k;
	cin>>n>>k;
	vector<vector<int>> adj(n, vector<int>(n));
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			cin>>adj[i][j];
		}
	}
	po(adj, k);
	//~ printVV(adj);
	int ans=0;
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			ans=add(ans, adj[i][j]);
		}
	}
	cout<<ans<<"\n";
    return 0;
}



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

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

    int count = 0;
    if(s[0] == t[0]){
        count++;
    }
    if(s[1] == t[1]){
        count++;
    }
    if(s[2] == t[2]){
        count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////

int main() {
ll ans = 0;
	int N;
	cin >> N;
	rep(i,N)
	{
		int a; cin >> a;
		ans += a-1;
	}

	cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<string> w(n);
  rep(i, n) {
    cin >> w[i];
  }
  set<string> st;
  st.insert(w[0]);
  bool ok = true;
  for (int i = 1; i < n; i++) {
    if (w[i - 1].back() != w[i].front()) {
      ok = false;
    }
    if (st.count(w[i])) {
      ok = false;
    }
    st.insert(w[i]);
  }
  if (ok) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 100;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */

/* main */
int main() {

    vector<int> v;
    int q; cin >> q;
    while (q--) {

        int op; cin >> op;
        if (op == 2) {
            v.pop_back();
        }
        else {
            int x; cin >> x;
            if (op == 0) 
                v.push_back(x);
            else if (op == 1) {
                cout << v[x] << '\n';
            }
        }
    }
}



Measured memory_bytes: 3844
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c;
	string str;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b>>str;
	if(str[b-1]=='A'){str[b-1]='a';}

	if(str[b-1]=='B'){str[b-1]='b';}
	if(str[b-1]=='C'){str[b-1]='c';}
	cout<<str;


	cout<<endl;
} 


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] li = sc.next().toCharArray();
		char ch = li[0];
		boolean check = false;
		for(int i = 1; i < 4; i++) {
			if(li[i] == ch) {
				check = true;
			}
			ch = li[i];
		}
		if(check == true) {
			System.out.println("Bad");
		}else {
			System.out.println("Good");
		}
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b,c,d,e;
    b=0;
    c=0;
    d=0;
    e=0;
    cin>>a;
    fr(i,a){
        string s;
        cin>>s;
        if(s=="AC") ++b;
        if(s=="WA") ++c;
        if(s=="TLE") ++d;
        if(s=="RE") ++e;
    }
    cout<<"AC x "<<b<<"\n"<<"WA x "<<c<<"\n"<<"TLE x "<<d<<"\n"<<"RE x "<<e<<"\n";
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9 + 7;

int main(void){
  int n;
  cin >> n;
  bool mm1,mm2;
  mm1 = (1 <= n / 100 && n / 100 <= 12);
  mm2 = (1 <= n % 100 && n % 100 <= 12);
  if(mm1 && mm2){
    cout << "AMBIGUOUS" << endl;
  }else if(mm1){
    cout << "MMYY" << endl;
  }else if(mm2){
    cout << "YYMM" << endl;
  }else {
    cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>

#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}




int dis[10][10];






int main()
{

	int n;
	cin >> n;

	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}

	int wk = INT_MAX;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (p[i] < wk) {
			wk = p[i];
			ans++;
		}


	}


	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 1024
N = int(input())
An_input = input().split()
An = [int(s) for s in An_input]

cnt = 0
k = 0
M = 10**9 + 7

for i in range(0, N-1):
    k += An[i]
    cnt += k * An[i+1]

ans = cnt % M
print(ans)

Measured memory_bytes: 31728
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;


int main(void){
    ll n,m,a;
    cin>>n>>m;
    priority_queue<ll,vector<ll>,less<ll>>pque;
    for(ll i=0;i<n;i++){
        cin>>a;
        pque.push(a);
    }
    for(ll i=0;i<m;i++){
        ll x=pque.top();
        pque.pop();
        x=x/2;
        pque.push(x);
    }
    ll ans=0;
    while(!pque.empty()){
        ll x=pque.top();
        pque.pop();
        ans+=x;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
def ctonum(c):
	alp = "qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=[0 for i in range(100)]

S=input()
T=input()

for i in range(len(S)):
	countS[ctonum(S[i])]+=1
	countT[ctonum(T[i])]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

// ############################################################################################

#define FOREACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define FOR(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define FORE(i, a, n) for (i = (a); i < (int)(n); ++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()

#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>

#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>

#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

#define mod 1000000007
#define inf 1e18

#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

// ############################################################################################

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2) res = (res * base) % mod;
        base = (base * base) % mod;
        exp /= 2;
    }
    return res % mod;
}

void a_k_s() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
}

int dp[3005][3005];
string s, t;

string getLCS(int len) {
    string lcs;

    int i = 0, j = 0;
    while (len > 0) {
        if (s[i] == t[j]) {
            lcs += s[i];
            i++;
            j++;
            len--;
        } else {
            if (dp[i][j + 1] > dp[i + 1][j])
                j++;
            else
                i++;
        }
    }

    return lcs;
}

int lenLCS(int i, int j) {
    // Base Case
    if (i >= s.length() || j >= t.length())
        return 0;

    // Look Up
    if (dp[i][j] != -1)
        return dp[i][j];

    // Recursive Case
    if (s[i] == t[j])
        return dp[i][j] = 1 + lenLCS(i + 1, j + 1);
    else
        return dp[i][j] = max(lenLCS(i, j + 1), lenLCS(i + 1, j));
}

int main() {
    a_k_s();

    cin >> s >> t;

    memset(dp, -1, sizeof dp);

    int len = lenLCS(0, 0);

    cout << getLCS(len) << endl;

    return 0;
}

Measured memory_bytes: 39148