akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long a, b;

int main(){
    scanf("%ld%ld", &a, &b);
    printf("%ld\n", a*b);
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
int t1,t2,t3;
int main(){
	cin>>t1>>t2>>t2>>t2>>t2>>t3;
	if(t2-t1>t3){
		cout<<":(";
	}else{
		cout<<"Yay!";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
map<ll,ll> mp;
const ll mod=1000000007;
int main(){
string s;
cin>>s;
int cnt=0;
if(s.size()==1){
    cout<<s<<endl;
    return 0;
}
for(int i=0;i<s.size();i++){
if(s.at(i)!='0')cnt++;
}
if(cnt>=2){
int ans=0;
for(int i=0;i<s.size();i++){
    ans+=(s.at(i)-'0');
}
cout<<ans<<endl;
}
else if(s.at(0)!='1'){
   cout<<(s.at(0)-'0')<<endl;
}
else cout<<10<<endl;
}



Measured memory_bytes: 256
//usr/bin/env picoc $0 - $@;exit
#include <stdio.h>
int main(){
	int n,y,i,j,k;
	scanf("%d%d",&n,&y);
	for(i=0;i<=n;i++)for(j=0;j<=n-i;j++){
		k=n-i-j;
		if(i*1000+j*5000+k*10000==y){
			printf("%d %d %d\n",k,j,i);
			return 0;
		}
	}
	puts("-1 -1 -1");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    Int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    Int res = 0;
    Int l, r;
    l = r = 0;
    vector<Int> t;
    for (Int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            if (r > 0) {
                t.push_back(r);
                res += r - 1;
                r = 0;
            }
            l++;    
        }
        else {
            if (l > 0) {
                t.push_back(l);
                res += l - 1;
                l = 0;
            }
            r++;
        }
    }
    if (l > 0) {
        t.push_back(l);
        res += l - 1;
    }
    if (r > 0) {
        t.push_back(r);
        res += r - 1;
    }
    Int m = t.size();
    if (m <= 2 * k + 1) {
        dump(n - 1);
        return 0;
    }
    vector<Int> b(m + 1, 0);
    for (Int i = 0; i < m; i++) {
        b[i + 1] += t[i] + b[i];
    }
    Int ma = 0;
    Int index = 0;
    for (Int i = 0; i < m - (2 * k + 1); i++) {
        //ma = max(ma, b[i + 2 * k + 1] - b[i]);
        if (ma < b[i + 2 * k + 1] - b[i]) {
            ma = b[i + 2 * k + 1] - b[i];
            index = i;
        }
    }
    Int sub = 0;
    for (Int i = index; i < index + 2 * k + 1; i++) {
        sub += t[i] - 1;
    }
    //cout << res << " "  << ma << " " << sub << endl;
    dump(res + ma - 1 - sub);
    return 0;
}

Measured memory_bytes: 2164
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,m,k,ans,q=0;
  cin >> n >> m >> k;
  q=(q+(COM(n+1,3)+COM(n+1,3))*m%MOD*m)%MOD;
  q=(q+(COM(m+1,3)+COM(m+1,3))*n%MOD*n)%MOD;
  q=q*modinv(COM(m*n,2))%MOD*modinv(2)%MOD;
  ans=(COM(n*m,k)*COM(k,2)%MOD*q%MOD+MOD)%MOD;
  printf("%lld",ans);
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

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

    int64_t odd = 0, even = 0;
    int64_t sum = 0, sign = 1;
    for(int i = 0; i < n; i++){
        sum += a[i];
        if(sum * sign <= 0){
            even += abs(sum) + 1;
            sum = sign;
        }
        sign *= -1;
    }

    sum = 0; sign = -1;
    for(int i = 0; i < n; i++){
        sum += a[i];
        if(sum * sign <= 0){
            odd += abs(sum) + 1;
            sum = sign;
        }
        sign *= -1;
    }

    cout << min(odd, even) << endl;

    return 0;
}

Measured memory_bytes: 640
fun main(args:Array<String>) {
	val (h,w) = readLine()!!.split(" ").map{ it.toInt() }
	val a = (1..h).map{ readLine()!! }
	val xb = BooleanArray(w){ x-> a.any{ it[x]=='#' } }
	val yb = BooleanArray(h){ y-> a[y].contains('#') }
	
	for(i in 0..h-1){
		if(!yb[i]) continue
		for(j in 0..w-1){
			if(xb[j]) print(a[i][j])
		}
		println()
	}
	
}

Measured memory_bytes: 37928
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[] dp;
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			int[] a = new int[n];
			for(int i = 0;i < n;i++){
				a[i] = scan.nextInt();
			}
			dp = new int[n];
			dp[0] = a[0];
			for(int i = 0;i < n;i++){
				for(int j = 0;j < i;j++){
					dp[i] = maximum(a[i],a[i]+dp[j]);
				}
			}
			Arrays.sort(dp);
			System.out.println(dp[dp.length-1]);
		}
	}
	public static int maximum(int a,int b){
		return (a > b)?a:b;
	}
}

Measured memory_bytes: 26556
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int w, a, b; cin >> w >> a >> b;
    if(a > b) swap(a, b);

    cout << max(0, b - (a + w)) << endl;

    return 0;
}


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

typedef long long ll;

int N, Q;
vector<ll> c, q;

int main() {
	cin >> N >> Q;
	c.resize(N); q.resize(Q);
	ll tmp;
	for(int i = 0; i < N; i++) {
		scanf("%lld", &tmp);
		c[i] = tmp;;
	}
	for(int i = 0; i < Q; i++) {
		scanf("%lld", &tmp);
		q[i] = tmp;
	}

	sort(c.begin(), c.end());
	for(ll i = 0; i < q.size(); i++) {
		ll res = 0;
		for(ll j = 1; (j-1) * q[i] < c.back(); j++) {
			vector<ll>::reverse_iterator it;
			it = upper_bound(c.rbegin(), c.rend(), j*q[i], greater<ll>());
			if(it != c.rend())
				res = max(res, (*it) % q[i]);
		}
		printf("%lld\n", res);
	}
}

Measured memory_bytes: 4176
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	v2 c(n+1, v1(0));
	vector<pair<int, int>> frend(0);
	vector<pair<int, int>> block(0);
	rep(i, m){
		int x, y;
		cin >> x >> y;
		c.at(x).push_back(y);
		c.at(y).push_back(x);
		frend.push_back(make_pair(x,y));
	}
	rep(i, k){
		int x, y;
		cin >> x >> y;
		block.push_back(make_pair(x, y));
	}
	rep(i, n){
		c.at(i).push_back(1e8);
	}
	v1 color(n+1, 0);//0が未訪問-1は保留
	v1 ColorSize(n+1, 0);
	queue<int> Q;
	for(int i = 1; i <=n; i++){
		if(color.at(i) != 0) continue;
		Q.push(i);
		while(!Q.empty()){
			int u = Q.front();
			int g = c.at(u).size();
			for(int j = 0; j < g; j++){
				if(c.at(u).at(j) == 1e8) break;
				if(color.at(c.at(u).at(j)) == 0){
					color.at(c.at(u).at(j)) = -1;
					Q.push(c.at(u).at(j));
				}
			}
			color.at(u) = i;
			ColorSize.at(i)++;
			Q.pop();
		}
	}
	v1 fr(n+1);
	for(int i = 1; i<=n; i++){
		fr.at(i) = ColorSize.at(color.at(i));
	}
	for(int i = 0; i<m; i++){
		int x = frend.at(i).first;
		int y = frend.at(i).second;
		if(color.at(x) == color.at(y)){
			fr.at(x)--;
			fr.at(y)--;
		}
	}
	rep(i, k){
		int x = block.at(i).first;
		int y = block.at(i).second;
		if(color.at(x) == color.at(y)){
			fr.at(x)--;
			fr.at(y)--;
		}
	}
	for(int i = 1; i<=n; i++){
		cout << fr.at(i)-1 <<" ";
	}
	cout << endl;
}


Measured memory_bytes: 12720
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back 
#define mp make_pair
#define sp ": "
#define cs "Case "
#define fi first
#define sn second 
#define po(x) x*x
#define pi 3.14159
/* STL */
#define vi vector<int>v
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxa(a) *max_element(a, a.size())
#define r(a) reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n)i=1;i<=(n);i++)
#define fa(i,a,n) for(__typeof(a)i=(a);i<=(b);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define db(something)   cerr<<#something<<" - "<<something<<"\n";         
int main()
{
  
   Ezio
   /*Variables*/
   /*Code*/
   double x;
   cin>>x;
   
   cout<<fixed<<setprecision(3)<<2*pi*(x)<<endl;
   return 0;
}
    

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

using namespace std;




int main()
{
    int x,y;
    cin>>x>>y;
    if((4*x-y)%2==0 && (4*x-y)>=0)
    {
            int a=(4*x-y)/2;
            int b=x-a;
            if(b>=0){
            cout<<"Yes"<<endl;}
            else
            {
                cout<<"No"<<endl;
            }
            return 0;
    }
    else
    {
           cout<<"No"<<endl;
           return 0;
    }
    
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define N 200020
const int inf=0x3f3f3f3f;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N],b[N],T,p[N],ans,s[N],dp[33];
int main(){
	n=read(),T=read();
	for(int i=1;i<=n;++i){
		a[i]=read(),b[i]=read(),p[i]=i;
	}
	sort(p+1,p+n+1,[&](int i,int j){return a[i]>a[j];});
	int m=n;
	while(m&&!a[p[m]])--m;
	sort(p+1,p+m+1,[&](int i,int j){return 1LL*(b[i]+1)*a[j]<1LL*(b[j]+1)*a[i];});
	sort(p+m+1,p+n+1,[&](int i,int j){return b[i]<b[j];});
	for(int i=1;i<=n-m;++i){
		s[i]=min(inf,s[i-1]+b[p[i+m]]+1);
	}
	s[n-m+1]=inf;
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=1;i<=m;++i){
		for(int j=30;j>=1;--j){
			dp[j]=min(1LL*dp[j],dp[j-1]+1LL*(dp[j-1]+1)*a[p[i]]+b[p[i]]+1);
		}
	}
	int now=0;
	for(int i=30;i>=0;--i){
		if(dp[i]>T)continue;
		while(s[now+1]<=T-dp[i])++now;
		ans=max(ans,now+i);
	}
	printf("%d\n",ans);
	return 0;
}



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

int main() {
  int a, b, c, n;
  cin >> n;
  
  for(int i = 0; i < n; i++){
        cin >> a >> b >> c;
        if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a) cout << "YES" << endl;
        else cout << "NO" << endl;
  }
}


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

#define pb push_back
#define mp make_pair
#define ft first
#define sc second
#define ull unsigned long long int
#define lli long long int
#define li long int

#define si(n) scanf("%d",&n)
#define sl(n) scanf("%ld",&n)
#define sll(n) scanf("%lld",&n)

#define pi(n) printf("%d",n)
#define pl(n) printf("%ld",n)
#define pll(n) printf("%lld",n)

using namespace std;

const int MAX=2e5+5;

lli A[MAX], cum[MAX];

int part(int start, int last) {
    int L = start, R = last;
    lli deduct = cum[start-1], least = (lli)(1e15); int ind = -1;

    //bool debug = 0; if(start == 5 || last == 5) { debug = 1;}
    //if(debug)
        //cout << "start = " << start << "\tlast = " << last <<  "\tDeduct = " << deduct << "\n";
    while(start<last) {
        int mid = (start+last)>>1;
        lli Leftval = cum[mid]-deduct, Rightval = cum[R]-cum[mid];
        //if(debug)
            //cout << "start = " << start << "\tlast = " << last << "\tLeftval = " <<  Leftval << "\tRightval = " << Rightval << "\n";
        if(cum[mid]-deduct == cum[R]-cum[mid])
            return mid;
        if(cum[mid]-deduct < cum[R]-cum[mid]) {
            if(least > abs(cum[R]-2*cum[mid]+deduct)) {
                least = abs(cum[R]-2*cum[mid]+deduct); ind = mid;
            }
            start = mid+1;
        }
        else {
            if(least > abs(cum[R]-2*cum[mid]+deduct)) {
                least = abs(cum[R]-2*cum[mid]+deduct); ind = mid;
            }
            last = mid-1;
        }
    }
    //cout << "Least = " << least << "\tFinal start = " << start << "\tFinal last = " << last << "\n";
    lli other = (lli)(1e15);
    if(start == last) {
        other = abs(cum[start]-cum[L-1] - (cum[R]-cum[start]));
        //cout << "Start = Last \tother = " << other << "\n";
    }
    if(other < least) {
        ind = start; least = other;
    }
    if(start == last) {
        other = abs(cum[start-1]-cum[L-1] - (cum[R]-cum[start-1]));
        //cout << "Start = Last \tother = " << other << "\n";
    }
    //cout << L << " " << R << " ind = " << ind << "\n";
    if(other < least)
        ind = start-1;
    return ind;
}

int main() {
    // freopen("a.in","r",stdin);
    // freopen("a.out","w",stdout);
    int N;
    cin >> N;
    cum[0] = 0;
    for(int i=1; i<=N; i++) {
        cin >> A[i]; cum[i] = cum[i-1] + A[i];
    }

    lli ans = (lli)(1e15);
    for(int i=2; i<N; i++) {
        int j = part(1,i);
        //cout << "-----------\n";
        int k = part(i+1,N);
        lli B = cum[j], C = cum[i]-cum[j], D = cum[k]-cum[i], E = cum[N]-cum[k];
        lli mx = max(B,max(C, max(D,E))), mn = min(B, min(C,min(D,E)));
        //cout << j << "\t" << i << "\t" << k << "\n";

        if(ans > (mx-mn)) {
            ans = mx-mn;
        }
    }

    cout << ans << "\n";



    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <climits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;
static const int INF = INT_MAX;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

static const int N = 2010;
int M[N][N];
int color[N];
int d[N];
int p[N];
int n;

void dijkstra(int s) {
  rep(u, n) {
    color[u] = WHITE;
    d[u] = INF;
  }
  d[s] = 0;
  p[s] = -1;

  while (true) {
    int mincost = INF;
    int u;
    rep(i, n) {
      if (color[i] != BLACK && d[i] < mincost) {
        mincost = d[i];
        u = i;
      }
    }

    if (mincost == INF) break;

    color[u] = BLACK;

    rep(v, n) {
      if (color[v] != BLACK && M[u][v] != INF) {
        if (d[u] + M[u][v] < d[v]) {
          d[v] = d[u] + M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
}

int main() {
  cin >> n;
  rep(y, n) rep(x, n) {
    M[y][x] = INF;
  }
  rep(i, n) {
    int u, k;
    cin >> u >> k;
    rep(j, k) {
      int v, c;
      cin >> v >> c;
      M[u][v] = c;
    }
  }
  dijkstra(0);
  rep(v, n) cout << v << " " << d[v] << endl;
  return 0;
}



Measured memory_bytes: 3424
N = int(input())
A = [int(item) for item in input().split()]
res = 0
p = 1
for i in range(N-1):
  res += p*A[i]
  p *= -1
m1 = A[-1] + res
M = [m1]
for i in range(N-1):
  M.append(2*A[i] - M[-1])
print (" ".join(map(str, M)))

Measured memory_bytes: 19140
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  string str;
  cin >> str;
  int count = 0;
  rep(i, 3) {
    if (str.at(i) == 'A')
      count++;
  }
  if (count == 0 or count == 3)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
x,y=c-a,d-b
print('U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*(y+1)+'R'*(x+1)+'D'+'R'+'D'*(y+1)+'L'*(x+1)+'U')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int n;
	cin>>n;
	char s[n];
	cin>>s;
	if((n%2)!=0)
	{
		cout<<"No"<<endl;
	}
	else
	{
		char s1[n];
		for(int i=0,j=0;i<n/2;i++,j++)
		{
			s1[j]=s[i];
		}
		int j=n/2;
		for(int i=0;i<n/2;i++,j++)
		{
			s1[j]=s[i];
		}
		int c = strcmp(s,s1);
		if(c)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	int a, b, c, d;

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

	if(a+b>c+d){
		cout<<"Left"<<endl;
	}else if(a+b==c+d){
		cout<<"Balanced"<<endl;
	}else{
		cout<<"Right"<<endl;
	}
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#define MEM(x,y) memset ( x , y , sizeof ( x ) )
#define rep(i,a,b) for (int i = (a) ; i <= (b) ; ++ i)
#define per(i,a,b) for (int i = (a) ; i >= (b) ; -- i)
#define pii pair < int , int >
#define one first
#define two second
#define rint read<int>
#define int long long
#define pb push_back
#define db double
#define ull unsigned long long
#define lowbit(x) ( x & ( - x ) )
#define mp std::make_pair

using std::queue ;
using std::set ;
using std::pair ;
using std::max ;
using std::min ;
using std::priority_queue ;
using std::vector ;
using std::swap ;
using std::sort ;
using std::unique ;
using std::greater ;

template < class T >
    inline T read () {
        T x = 0 , f = 1 ; char ch = getchar () ;
        while ( ch < '0' || ch > '9' ) {
            if ( ch == '-' ) f = - 1 ;
            ch = getchar () ;
        }
       while ( ch >= '0' && ch <= '9' ) {
            x = ( x << 3 ) + ( x << 1 ) + ( ch - 48 ) ;
            ch = getchar () ;
       }
       return f * x ;
    }

const int N = 1e6 + 7 ;

bool mk[N] ;
int n , v[N] , ans ;
int bin[N] ;

signed main () {
	n = rint () ; int maxn = - 1 ;
	rep ( i , 1 , n ) { v[i] = rint () ; ++ bin[v[i]] ; maxn = max ( maxn , v[i] ) ; }
	rep ( i , 1 , n ) {
		if ( bin[v[i]] > 1 ) mk[v[i]] = true ;
		int cnt = 2 ;
		while ( true ) {
			if ( v[i] * cnt > maxn ) break ;
			mk[v[i]*cnt] = true ; ++ cnt ;
		}
	}
	rep ( i , 1 , n ) if ( ! mk[v[i]] ) ++ ans ;
	printf ("%lld\n" , ans ) ; return 0 ;
}


Measured memory_bytes: 14044
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var k = int.Parse(Console.ReadLine().Trim());
        getAns(k);
    }
    static void getAns(int k)
    {
        if (k % 2 == 0) { Console.WriteLine(-1); return; }
        var hs = new HashSet<int>();
        var a = 7;
        var p = 1;
        while (true)
        {
            a %= k;

            if (a == 0) { Console.WriteLine(p); return; }
            else
            {
                if (!hs.Add(a)) { Console.WriteLine(-1); return; }
            }
            a = a * 10 + 7;
            p++;
        }
    }
}


Measured memory_bytes: 60436
D = gets.to_i
c = gets.split.map(&:to_i)
s = []
D.times do
  s << gets.split.map(&:to_i)
end

ld = Array.new(26,0)
v = 0
(1..D).each do |day|
  tmp = []
  26.times do |i|
    tmpv = v
    tmpv += s[day - 1][i]
    
    26.times do |j|
      next if j == i
      
      tmpv -= (c[j] * (day - ld[j]))
    end
    tmp << tmpv
  end
  
  cont = tmp.index(tmp.max)
  v = tmp.max
  ld[cont] = day
  puts cont + 1
end

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
const long double PI = (acos(-1));

int main(){
	long double a,b,x;
	cin >> a >>b >>x;
	long double rad = atan(2.0*x/(a*b*b));
	if (x < a*a*b/2.0){
		cout << std::setprecision(10) << (PI/2.0- rad)*(180.0/PI) <<endl;
	}
	else{
		long double rad_2 = atan(2.0*(b* a*a - x)/(a*a*a));
		cout << std::setprecision(10) << (rad_2)*(180.0/M_PI) <<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	vector<int>arr(n+1);
	for(int i=1; i<=n; i++)
	 cin>>arr[i];
	vector<int>table(n+1,2e9);
	table[1]=0;
	for(int i=2; i<=n; i++){
		for(int j=1; j<=min(k,i-1); j++){
			table[i]=min(table[i],abs(arr[i]-arr[i-j])+table[i-j]);
		}
	}
	cout<<table[n];
	return 0;
}

Measured memory_bytes: 3988
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,i,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

char sign(int i, int n){
	return (i & (1 << n)) ? '+' : '-';
}

void solve(){
	char a[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];

	int i = 0;
	while(!(i & (1 << 3))){
		int tmp = a[0] - '0';
		rep(j,3){
			if(i & (1 << j)){
				tmp += a[j+1] - '0';
			}else{
				tmp -= a[j+1] - '0';
			}
		}
		if(tmp == 7){
			break;
		}
		i++;
	}

	cout << a[0] << sign(i,0) << a[1] << sign(i,1) << a[2] << sign(i,2) << a[3] << "=7" << endl;
}

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

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

#define int long long

int n,m;
int a[100000],b[100000];

struct UnionFind {
	vector<int> data;
	UnionFind(int sz):data(sz,-1) {}
	bool unite(int x,int y) {
		x=root(x),y=root(y);
		if(x!=y) {
			if(data[y]<data[x]) swap(x,y);
			data[x]+=data[y],data[y]=x;
		}
		return x==y;
	}
	bool same(int x,int y) {
		return root(x)==root(y);
	}
	int root(int x) {
		return data[x]<0?x:root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

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

	cin>>n>>m;
	UnionFind uf(n);
	REP(i,m) {
		cin>>a[i]>>b[i];
		a[i]--,b[i]--;
		uf.unite(a[i],b[i]);
	}
	int mi=min(uf.size(0),uf.size(1));
	int ma=n-mi;
	cout<<mi*(mi-1)/2+ma*(ma-1)/2-m<<endl;

	return 0;
}


Measured memory_bytes: 2560
n = int(input())
w = []
for i in range(n):
    s = input()
    w.append(s)

jdg = 'Yes'
if len(set(w)) != len(w):
    jdg = 'No'
    print(jdg)
    exit()

for i in range(1,n):
    if w[i-1][-1] != w[i][0]:
        jdg = 'No'
        break 
    
print(jdg)

Measured memory_bytes: 3064
#include <stdio.h>
 
void sh(int x, int y, int h, int w);
 
int main(void){
	
	while(1){
		int h, w, x, y;
		scanf("%d %d", &h, &w);
		if (h == 0 & w == 0) {
			return 0;
        }
		
        for (y = 0; y < h; y++) {
            for (x = 0; x < w; x++) {
                sh(x + 1, y + 1, h, w);
            }
            printf("\n");
        }
        printf("\n");
    }
}
 
void sh(int x, int y, int h, int w)
{
    if (x == 1 | x == w | y == 1 | y == h) {
        printf("#");
    } else {
        printf(".");
    }
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

pair<int, int> dfs_Farthest(int v, vector<vector<pair<int, int> > > &list, int dist, int parent){
  pair<int, int> max(dist, v), tmp;
  for(int i = 0; i < list[v].size(); i++){
    if(list[v][i].second == parent){ continue; }
    tmp = dfs_Farthest(list[v][i].second, list, dist + list[v][i].first, v);
    if(tmp.first > max.first){ max = tmp; }
  }
  return max;
}

int main(void){
  while(true){
    int n;
    cin >> n;
    if(n == 0){ break; }

    // ???????????±???????????????
    int sum = 0;
    vector<int> p(n-1), d(n-1);
    for(int i = 0; i < n-1; i++){ cin >> p[i]; }
    for(int i = 0; i < n-1; i++){
      cin >> d[i];
      sum += d[i];
    }

    // ??£??\?????????????§????
    int a, b;
    vector<vector<pair<int, int> > > adjlist(n);
    for(int i = 0; i < n-1; i++){
      a = i + 1;
      b = p[i] - 1;
      adjlist[a].push_back(make_pair(d[i], b));
      adjlist[b].push_back(make_pair(d[i], a));
    }

    // ?????\: ?????¨??? * 2 - ?????¨?????????????????????????????¨?????°???????????´??? + ??¨???

    // ????????¨?????¨????????????????¨????
    int leaves = 0;
    vector<bool> IamLeaf(n, false);
    for(int i = 0; i < n; i++){
      if(adjlist[i].size() == 1){
        IamLeaf[i] = true;
        leaves += adjlist[i][0].first;
      }
    }
    int inners = sum - leaves;

    // ?????¨?????????????????????????????¨?????°???????????????
    vector<vector<pair<int, int> > > innerlist(n);
    for(int i = 0; i < n-1; i++){
      if(IamLeaf[i]){ continue; }
      for(int j = 0; j < adjlist[i].size(); j++){
        if(!IamLeaf[adjlist[i][j].second]){
          innerlist[i].push_back(adjlist[i][j]);
        }
      }
    }

    // ?????¨?????????????????????????????¨?????°???????????´???????±???????
    // ???????????§???????????????1????±???????
    int v;
    for(v = 0; v < n; v++){
      if(!IamLeaf[v]){ break; }
    }
    // ??¨??¨???????????£???????????¨????????????????????????
    if(v == n){
      cout << sum << endl;
      continue;
    }

    // ???????????§??????????????????dfs??????????????????????????????????±???????
    // ??????????????????dfs???????????????????????????????????§????????¢(=??´???)????±???????
    pair<int, int> farthest = dfs_Farthest(v, innerlist, 0, -1);
    int diam = dfs_Farthest(farthest.second, innerlist, 0, -1).first;
    
    // ???????????????
    int result = inners * 2 - diam + sum;
    cout << result << endl;
  }

  return 0;
}

Measured memory_bytes: 1368
#include<stdio.h>
#include <math.h>
int main(){
  int x,y,a,b;
  do{
  scanf("%d%d",&x,&y);
  }while(x<1 || y>pow(10,9));
  
  if(x<y){
    b=x;
    x=y;
    y=b;
  }
  
 
  a=x%y;
  while(a!=0){
    x=y;
    y=a;
    a=x%y;
  }
  printf("%d\n",y);
  return 0;
}



Measured memory_bytes: 2104
import collections
#H  = map(int, input().split())
H  = int(input())
dic = collections.defaultdict(int)
for _ in range(H):
    dic[input()]+=1
ma = max(dic.values())
res = []
for k in dic.keys():
    if dic[k] == ma:
        res.append(k)
for s in sorted(res):
    print(s)
        

Measured memory_bytes: 33372
n = int(input())
a = list(map(int,input().split()))
snuke = 0
arai = sum(a)
ans = 2*(10**9)
for i in range(n-1):
    snuke += a[i]
    arai -= a[i]
    ans = min(ans,abs(snuke-arai))
print(ans)

Measured memory_bytes: 30600
#include<stdio.h>
int main(){
  int l=1000010,n,q;
  int d[l];
  long long m[l],c[l],x[l];
  m[0]=0;
  c[0]=0;
  x[0]=0;
  char s[l];
  for(int i=0;i<l;i++)d[i]=-1;
  scanf("%d%s%d",&n,s,&q);
  int j=0;
  for(int i=1;i<=n;i++){
    m[i]=m[i-1];
    c[i]=c[i-1];
    x[i]=x[i-1];
    if(s[i-1]=='D')d[j++]=i-1;
    else if(s[i-1]=='M')m[i]++;
    else if(s[i-1]=='C'){
      c[i]++;
      x[i]+=m[i];
    }
  }
  while(q--){
    long long a=0;
    int k;
    scanf("%d",&k);
    for(int i=0;d[i]>-1;i++){
      int j=d[i];
      int l=j+k;
      if(l>n)l=n;
      a+=x[l]-x[j]-(c[l]-c[j])*m[j];
    }
    printf("%lld\n",a);
  }
}

Measured memory_bytes: 28544
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

using namespace std;

bool check(ll n, ll a, ll b){
	string s = to_string(n);
	ll ngo = 0;
	for (char c : s) ngo += c - '0';
	return a <= ngo && ngo <= b;
}

int main(){
	ll n, a, b; cin >> n >> a >> b;
	ll ans = 0;
	for (ll i = 0; i <= n; ++i){
		if (check(i, a, b)) ans += i;
	}cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> a(N), cnt(100000);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }

    for (int i = 0; i < 100000; i++){
        cnt[i] = 0;
    }

    for (int i = 0; i < N; i++) {
        cnt[a[i]] = cnt[a[i]] + 1;
        if (a[i] > 0) {
            cnt[a[i] - 1] = cnt[a[i] - 1] + 1;
        }
        if (a[i] < 99999) {
            cnt[a[i] + 1] = cnt[a[i] + 1] + 1;
        }
    }
    int maxcnt = 1;

    for (int i = 0; i < N; i++) {
        maxcnt = max(maxcnt, cnt[i]);
    }
    cout << maxcnt << endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    int i = 1;
    LL res = 1;
    for(int i = 2; i <= n; ++i) {
        res = res * i % MOD;

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin >> a >> b;
    string s,t;
    for(int i = 0; i < a; i++)
    s += to_string(b);
    for(int i = 0;i < b; i++)
    t += to_string(a);
    if(a < b) cout << t << endl;
    else
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int ans = 0;
    string N;
    cin >> N;
    rep(i, 4) {
        if (N[i] == '2') ans++;
    }
    cout << ans << endl;
    return 0;
}


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

class FIELD {
public:
  FIELD(int w, int h) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
  }
  FIELD(int w, int h, const char* pc) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        at(x, y) = *(pc + x + y * m_w) == ' ' ? '0' : '1';
      }
    }
  }
  ~FIELD() {
    delete[] m_pData;
  }
  const char& at(int x, int y) const {
    return *(m_pData + x + y * m_w);
  }
  char& at(int x, int y) {
    return *(m_pData + x + y * m_w);
  }
  int GetWidth() const {
    return m_w;
  }
  int GetHeight() const {
    return m_h;
  }
  bool set() {
    for (int y = 0; y < m_h; y++) {
      std::string line;
      std::cin >> line;
      if (std::cin.eof()) {
        return false;
      }
      std::memcpy(m_pData + y * m_w, line.c_str(), m_w);
    }
    return true;
  }
  void echo() const {
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        std::cout << at(x, y);
      }
      std::cout << std::endl;
    }
  }

private:
  int m_w;
  int m_h;

  char* m_pData;
};

static const FIELD patA(2, 2,
  "**"
  "**"
);

static const FIELD patB(1, 4,
  "*"
  "*"
  "*"
  "*"
);

static const FIELD patC(4, 1,
  "****"
);

static const FIELD patD(2, 3,
  " *"
  "**"
  "* "
);

static const FIELD patE(3, 2,
  "** "
  " **"
);

static const FIELD patF(2, 3, 
  "* "
  "**"
  " *"
);

static const FIELD patG(3, 2,
  " **"
  "** "
);

bool matchTemplate_core(const FIELD& src, const FIELD& templ, int x, int y) {

  for (int yy = 0; yy < templ.GetHeight(); yy++) {
    for (int xx = 0; xx < templ.GetWidth(); xx++) {
      if (src.at(x + xx, y + yy) != templ.at(xx, yy)) {
        return false;
      }
    }
  }

  return true;
}

bool matchTemplate(const FIELD& src, const FIELD& templ) {
  int rangeW = src.GetWidth() - templ.GetWidth();
  int rangeH = src.GetHeight() - templ.GetHeight();

  if (rangeW < 0 || rangeH < 0) {
    return false;
  }

  for (int y = 0; y <= rangeH; y++) {
    for (int x = 0; x <= rangeW; x++) {
      if (matchTemplate_core(src, templ, x, y)) {
        return true;
      }
    }
  }

  return false;
}

int main(void)
{
  FIELD f(8, 8);

  while (f.set()) {
    if (matchTemplate(f, patA)) std::cout << 'A' << std::endl;
    if (matchTemplate(f, patB)) std::cout << 'B' << std::endl;
    if (matchTemplate(f, patC)) std::cout << 'C' << std::endl;
    if (matchTemplate(f, patD)) std::cout << 'D' << std::endl;
    if (matchTemplate(f, patE)) std::cout << 'E' << std::endl;
    if (matchTemplate(f, patF)) std::cout << 'F' << std::endl;
    if (matchTemplate(f, patG)) std::cout << 'G' << std::endl;
  }

  return 0;
}


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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int a,b,c;
        cin>>a>>b>>c;
        if(a==b && b==c){cout<<"Yes";}
        else cout<<"No";   
     }
    signed main()
    {   
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll Pow(ll A, ll N, ll mod){
  if (N == 0) return 1;
  else{
    if (N % 2 == 0) return Pow(A * A % mod, N / 2, mod) % mod;
    else return (A % mod) * Pow(A * A % mod, N / 2, mod) % mod;
  }
}

int main(){
  int N, P; cin >> N >> P;
  string S; cin >> S;

  if (P == 2 || P == 5){
    ll ans = 0;
    for (ll i = 0; i < N; i++){
      int now = S[i] - '0';
      if (now % P == 0){
        ans += i + 1;
      }
    }
    cout << ans << endl;
    return 0;
  }

  ll DP[N + 1] = {};
  
  for (int i = N - 1; i >= 0; i--){
    ll now = S[i] - '0';
    now *= Pow(10, N - 1 - i, P);
    DP[i] = (DP[i + 1] + now) % P;
  }

  ll cnt[P] ={};
  for (int i = 0; i < N + 1; i++){
    cnt[DP[i]]++;
  }

  ll ans = 0;
  for (int i = 0; i < N; i++){
    ans += cnt[DP[i]] - 1;
    cnt[DP[i]]--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
    ll ans=1;
    for(int i=1; i<=n; i++)
        ans*=a;
    return ans;
}

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

    ll n,ans=0;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>A[i];
    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            for(int k=j+1; k<=n; k++)
            {
                if(A[i]!=A[j]&&A[j]!=A[k]&&A[i]!=A[k])
                {
                    if(A[i]+A[j]>A[k]&&A[i]+A[k]>A[j]&&A[j]+A[k]>A[i])
                        ans++;
                }
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int gcd(int a,int b){
	if(a%b==0) return b;
	else return gcd(b,a%b);
}

int main(){
	int k;
	cin>>k;
	
	ll sum=0;
	
	for(int i=1;i<=k;i++)
		for(int j=1;j<=k;j++)
			for(int m=1;m<=k;m++)
				{
					sum+=gcd(gcd(i,j),m);
				}
				
	cout<<sum; 
	return 0;
}



Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

//自作関数 a^n mod MODを求める
int m_pow(int a, int n){
  if(n == 0) return 1;
  if(n % 2 == 0){
    int t = m_pow(a, n / 2);
    return t * t % MOD;
  }
  return a * m_pow(a, n - 1) % MOD;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n,a,b;

  cin >> n >> a >> b;

  int t = (m_pow(2,n) - 1);

  int c = 1,d = 1;
  REP(i,a){
    c *= n - i;
    c %= MOD;
    d *= i + 1;
    d %= MOD;
  }
  //c * (d^{10^9 + 5} % MOD) % MOD
  int as = c * m_pow(d, MOD - 2) % MOD;

  c = 1,d = 1;
  REP(i,b){
    c *= n - i;
    c %= MOD;
    d *= i + 1;
    d %= MOD;
  }
  int bs = c * m_pow(d, MOD - 2) % MOD;

  int ans = t - as - bs;
  //ansが負になる場合があるのでmod計算をするためにMODを足す
  //ans < -MOD となる場合もあるのでwhileにする
  while(ans < 0) ans += MOD;

  cout << ans % MOD << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main() {
    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!{
        n: usize,
        mut spots: [i32; n],
    }
    spots.insert(0, 0);
    spots.push(0);
    let mut diffs = Vec::with_capacity(n + 1);
    let sum = spots.windows(3).fold(spots[1].abs(), |acc, w| {
        let d = (w[2] - w[1]).abs();
        diffs.push((w[2] - w[0]).abs() - (w[1]-w[0]).abs() - d);
        acc + d
    });
    for diff in diffs { println!("{}", sum + diff); } 
}


Measured memory_bytes: 3360
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll ret=0;
	int N; cin>>N;
	vector<int> A(N);
	for (int i=0; i<N; i++)
		cin>>A[i];
	int cur=A[0];
	for (int i=1; i<N; i++) {
		ret+=max(0,cur-A[i]);
		cur=max(cur,A[i]);
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3992