akhauriyash/Code-Regression huggingface dataset:
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


immutable MO = 10L^^9 + 7;

int M, N;
int[] A, B;

long solve() {
  A.sort();
  B.sort();
  A.reverse();
  B.reverse();
  debug {
    writefln("A = %s", A);
    writefln("B = %s", B);
  }
  
  auto xs = new int[M * N];
  auto ys = new int[M * N];
  xs[] = -1;
  ys[] = -1;
  foreach (x; 0 .. M) {
    if (xs[A[x]] != -1) {
      return 0;
    }
    xs[A[x]] = x;
  }
  foreach (y; 0 .. N) {
    if (ys[B[y]] != -1) {
      return 0;
    }
    ys[B[y]] = y;
  }
  
  long ans = 1;
  int cx, cy;
  foreach_reverse (i; 0 .. M * N) {
    for (; cx < M && i <= A[cx]; ++cx) {}
    for (; cy < N && i <= B[cy]; ++cy) {}
    long here;
    if (xs[i] != -1) {
      if (ys[i] != -1) {
        here = 1;
      } else {
        here = cy;
      }
    } else {
      if (ys[i] != -1) {
        here = cx;
      } else {
        here = cx * cy - (M * N - 1 - i);
      }
    }
    debug {
      writefln("i = %s: cx = %s, cy = %s, here = %s", i, cx, cy, here);
    }
    (ans *= here) %= MO;
  }
  return ans;
}

void main() {
  try {
    for (; ; ) {
      M = readInt();
      N = readInt();
      A = new int[M];
      B = new int[N];
      foreach (x; 0 .. M) {
        A[x] = readInt() - 1;
      }
      foreach (y; 0 .. N) {
        B[y] = readInt() - 1;
      }
      const ans = solve();
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 9980
S=input()
k=0
d=0
p=0
for i in range(0,len(S)):
    if S[i]==S[len(S)-i-1]:
        k=k
    else:
        k=k+1
for i in range (0,(len(S)-1)//2):
    if S[i]==S[(len(S)-1)//2-i-1]:
        d=d
    else:
        d=d+1
for i in range (0,(len(S)-1)//2):
    if S[(len(S)+3)//2+i-1]==S[len(S)-i-1]:
        p=p
    else:
        p=p+1
if k>0 or d>0 or p>0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
typedef pair <ll, int> P;

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

    int X, Y, a, b, c;
    cin >> X >> Y >> a >> b >> c;

    vector <ll> p(a), q(b), r(c);
    for (int i = 0; i < a; i++) cin >> p[i];
    for (int i = 0; i < b; i++) cin >> q[i];
    for (int i = 0; i < c; i++) cin >> r[i];

    priority_queue <P> Q;
    for (int i = 0; i < a; i++) Q.push({p[i], 0});
    for (int i = 0; i < b; i++) Q.push({q[i], 1});
    for (int i = 0; i < c; i++) Q.push({r[i], 2});

    int x = 0, y = 0, total = 0;
    ll ans = 0;

    while (total < X + Y) {
        P elm = Q.top();
        Q.pop();

        int val = elm.first;
        int idx = elm.second;

        if (idx == 0) {
            if (x < X && total < X + Y) {
                ans += val;
                x++;
                total++;
            }
        } else if (idx == 1) {
            if (y < Y && total < X + Y) {
                ans += val;
                y++;
                total++;
            }
        } else {
            if (total < X + Y) {
                ans += val;
                total++;
            }
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 12908
using System;
using System.Collections.Generic;
using System.IO;

class MainClass
{
  static public void Main(string[] args)
  {
    var N = Convert.ToInt64(Console.ReadLine());
    long res = 0;
    for (long i = 1; i <= N; i++) {
      var n = N / i;
      res += (i * n * (n + 1)) / 2;
    }
    Console.WriteLine(res);
  }
}


Measured memory_bytes: 27516
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  string a;
  cin>>a;
  int cnt=0;
  for(int i=0;i<a.size();i++){
  	char prev = a[i];
  	while(a[i]==prev)
  	{
  		i++;
  		if(i>=a.size())break;
  	}
  	i--;
  	cnt++;
  }
  cout<<cnt;
  
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

typedef unsigned short ushort;

template < ushort N >
bool MatchesEachDigit( ushort val )
{
    while ( val > 0 )
    {
        if ( val % 10 == N )
        {
            return true;
        }
        
        val /= 10;
    }
    
    return false;
}
 
int main( void )
{
    ushort N;
    std::cin >> N;
    
    std::cout << ( MatchesEachDigit<7>(N) ? "Yes" : "No" ) << std::endl;
    return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const LL mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

LL power(LL x, LL y, LL m) 
{ 
    if (y == 0) 
        return 1; 
    LL p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 

LL modInverse(LL a, LL m) 
{ 
    return power(a,m-2,m);
} 

LL findProductSum(vl &A, LL n) 
{ 
    LL array_sum = 0ll; 
    for (int i = 0; i < n; i++) 
        array_sum = (array_sum + A[i])%mod; 
    LL array_sum_square = (array_sum * array_sum)%mod; 
    LL individual_square_sum = 0ll; 
    for (int i = 0; i < n; i++) 
        individual_square_sum = (individual_square_sum+ (A[i]*A[i])%mod)%mod; 
    LL x = array_sum_square - individual_square_sum;
    if(x<0) x += mod;
    return x*(modInverse(2,mod))%mod;
} 

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    LL n;
    cin>>n;
    vl a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    cout<<findProductSum(a,n)<<endl;
}

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

int main(void){
    int N;
    cin>>N;
    int L[N],ans=0;
    for(int i=0;i<N;i++) cin>>L[i];
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]!=L[j] && L[j]!=L[k] && L[i]!=L[k]){
                    if(L[i]+L[j]>L[k] && L[j]+L[k]>L[i]&&L[i]+L[k]>L[j]) ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    if(N == 1 && M == 0) {
        cout << 0 << endl;
        return 0;
    }
    string ans(N, '_');

    while(M--) {
        int s, c;
        cin >> s >> c;
        --s;
        if(ans[s] == '_') {
            ans[s] = '0' + c;
        } else if(ans[s] != '0' + c) {
            cout << -1 << endl;
            return 0;
        }
    }

    if(ans.front() == '_') {
        ans.front() = '1';
    }
    for(int i=1; i<ans.size(); i++) {
        if(ans[i] == '_') {
            ans[i] = '0';
        }
    }

    if(ans.size() > 1 && ans[0] == '0') {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
#define ULL unsigned LL
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = res*10+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 3005; int n,P,c[N][N],s[N][N]; il int pow(int b,int k,int P) {int a = 1; while (k) {if (k&1) a = 1LL*a*b%P; b = 1LL*b*b%P; k >>= 1;} return a;}
	void main() {
		int ans = 0,x; n = read(); P = read(); s[0][0] = 1; rep(i,0,n+1) {c[i][0] = 1; rep(j,1,i) {c[i][j] = (c[i-1][j-1]+c[i-1][j])%P; s[i][j] = (s[i-1][j-1]+1LL*j*s[i-1][j]%P)%P;}}
		rep(i,0,n) {x = 0; rep(j,0,i) x = (x+1LL*s[i+1][j+1]*pow(pow(2,n-i,P),j,P)%P)%P; ans = (ans+(i&1?-1LL:1LL)*x*c[n][i]%P*pow(2,pow(2,n-i,P-1),P)%P)%P;} printf("%d\n",(ans+P)%P);
	}
}
int main() {
	qiqi::main(); return 0;
}

Measured memory_bytes: 58832
#include "bits/stdc++.h"


// vector
#define MAX_ELE(vec) *max_element(vec.begin(), vec.end())
#define SORT(vec) sort(vec.begin(), vec.end());


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

// string
#define TO_UP(str) transform(str.cbegin(), str.cend(), str.begin(), ::toupper)

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



using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
//  --------------------------------------

    int n, ans, p[20];
    ans = 0;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    
    for (int i = 1; i < n-1; i++)
    {
        if (p[i-1] < p[i] && p[i] < p[i+1])
        {
            ans += 1;
        }else if(p[i-1] > p[i] && p[i] > p[i+1]){
            ans += 1;
        }
        
    }
    
    cout << ans << "\n";

}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);++i)

int main(void){
  int K,A,B,cmp;
  cin >> K >> A >> B;
  cmp=(A/K)*K;
  if(cmp+K <= B || cmp == B || cmp == A) cout << "OK" <<endl;
  else cout << "NG" <<endl;
  return 0;
}


Measured memory_bytes: 3624
if __name__ == '__main__':
    n = int(raw_input())
    S = map(int, raw_input().split())
    S.append(0)
    q = int(raw_input())
    T = map(int, raw_input().split())
    cnt = 0
    for x in T:
        S[n] = x
        i = 0
        while S[i] != x:
            i += 1
        if i != n:
            cnt += 1
    print cnt


Measured memory_bytes: 5228
S = input()

if S[0] != "A":
  print("WA")
else:
  if S[2:-1].count("C") != 1:
    print("WA")
  else:
    s = [a for a in S]
    s.remove("A")
    s.remove("C")
    S = "".join(s)
    if S.islower():
      print("AC")
    else:
      print("WA")


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

const long long mod=998244353;

long long dp[305][100500]={};
long long dp2[305][100500]={};

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int cnt=0;
	dp[0][0]=1LL;
	for (int i = 0; i < n; ++i)
	{
		cnt+=a[i];
		for (int j = 0; j <= 100000; ++j)
		{
			dp[i+1][j]+=dp[i][j]*2LL%mod;
			dp[i+1][j]%=mod;
			dp[i+1][j+a[i]]+=dp[i][j]%mod;
			dp[i+1][j+a[i]]%=mod;
		}
	}
	long long ans=1LL;
	for (int i = 0; i < n; ++i)
	{
		ans*=3LL;
		ans%=mod;
	}
	for (int i = (cnt+1)/2; i <= cnt; ++i)
	{
		ans-=3LL*dp[n][i]%mod;
		ans%=mod;
	}
	if (cnt%2==0)
	{
		dp2[0][0]=1LL;
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j <= 100000; ++j)
			{
				dp2[i+1][j]+=dp2[i][j]%mod;
				dp2[i+1][j]%=mod;
				dp2[i+1][j+a[i]]+=dp2[i][j]%mod;
				dp2[i+1][j+a[i]]%=mod;
			}
		}
		ans+=3LL*dp2[n][cnt/2]%mod;
		ans%=mod;
	}
	ans+=mod;
	ans%=mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 476672
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

class mod;

#define MOD 1000000007

using lli = long long int;
using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int main(){

	int A, B, C;
	cin >> A >> B >> C;
	if(A <= C && C <= B){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
  return 0;
}

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

vector<int> edges[100001];
int vis[100001];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    vis[1] = 1;
    queue<int> Q;
    Q.push(1);
    while (!Q.empty()) {
        int x = Q.front();
        Q.pop();
        for (auto i : edges[x]) {
            if (!vis[i]) {
                vis[i] = x;
                Q.push(i);
            }
        }
    }
    for (int i = 2; i <= n; i++) {
        if (!vis[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i = 2; i <= n; i++) cout << vis[i] << endl;
}



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

#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) begin(a),end(a)

using namespace std;

int main()
{
  int a;
  map<int, int> count;

  REP(i, 3) {
    cin >> a;
    ++count[a];
  }

  if (count[5] == 2 && count[7] == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

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

    int N;

    cin >> N;

    vector<int> A(N);

    rep(i, N)
    {
        cin >> A[i];
    }

    rep(i, N)
    {
        if ((A[i]%2==0 && A[i] %3 !=0 && A[i]%5!=0))
        {
            cout << "DENIED";
            return 0;
        }
    }

    cout << "APPROVED";

    return 0;
}


Measured memory_bytes: 256
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

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

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ld n,m;
    cin>>n>>m;
    cout<<(ll)(n*m)<<endl;
	printclock;
	return 0;
}

Measured memory_bytes: 3812
#include <stdio.h>

// int gcd (int x,int y){
//     int tmp;
//
//     return tmp;
// }

int main() {

    int x,y,sp,tmp;
    int i = 1;

    scanf("%d %d",&x,&y);

    if(x < y){
        sp = x;
        x = y;
        y = sp;
    }
    tmp = x;
    while(x % y != 0){
        tmp = x % y;
        x = y;
        y = tmp;
    }

    printf("%d\n",tmp);

    return 0;
}



Measured memory_bytes: 2112
N = int(input())
A = list(map(int, input().split()))

ans, r = 0, 0
SUM, XOR = 0, 0

for l in range(N):
    while (r < N) and (SUM + A[r] == XOR ^ A[r]):
        SUM += A[r]
        XOR ^= A[r]
        r += 1

    ans += (r - l)
    SUM -= A[l]
    XOR ^= A[l]
print(ans)


Measured memory_bytes: 24712
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int dx[4]={1,0,-1,0}
,dy[4] = {0,1,0,-1};


int main()
{
	int h,w;
	cin >> h >> w;
	vector<string> g(h);
	for(int i  = 0;i<h;i++)
	{
		cin >> g[i];
	}
	for(int i = 0;i<h;i++)
	{
		for(int j = 0;j<w;j++)
		{
			if(g[i][j]=='#')
			{
				bool a = true;
				for(int k = 0;k<4;k++)
				{
					int x = i+dx[k];
					int y = j+dy[k];
					if(0<=x&&x<h&&0<=y&&y<w)
					{
						//if(i==0&&j==3)cout<<x<<y<<endl;
						if(g[x][y]=='#')
						{
							a=false;
						}
					}
				}
				if(a)
				{
					//cout<<i<<j<<endl;
					cout<<"No"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import defaultdict
    from collections import deque

    N,M,K = LMIIS()
    AB = XLMIIS(M)
    CD = XLMIIS(K)
    edge = defaultdict(set)
    redge = defaultdict(set)
    blocks = defaultdict(set)
    
    for a,b in AB:
        # if a > b:
        #     a,b = b,a
        edge[a].add(b)
        #redge[b].add(a)
        edge[b].add(a)
    for c,d in CD:
        # if c > d:
        #     c,d = d,c
        blocks[c].add(d)
        blocks[d].add(c)
        #blocks[c][d] = False
        #blocks[d][c] = False

    visited = [False] * (N+1)
    
    num_graph = 0
    which_graph = [-1] * (N+1)
    num_grapth_node = [0] * N

    friends = deque()
    

    for i in range(1,N+1):
        if visited[i]:
            continue
        friends.append(i)
        while len(friends) > 0:
            node = friends.pop()
            if visited[node]:
                continue
            visited[node] = True
            which_graph[node] = num_graph
            num_grapth_node[num_graph] += 1
            for e in edge[node]:
                friends.append(e)
        num_graph+=1


    for i in range(1,N+1):
        num_friends = 0
        for f in edge[i]:
            if which_graph[i] == which_graph[f]:
                num_friends += 1
        num_blocks = 0
        for b in blocks[i]:
            if which_graph[i] == which_graph[b]:
                num_blocks += 1
        print(num_grapth_node[which_graph[i]] - num_friends - num_blocks -1)









    

if __name__ == '__main__':
    main()

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


long long mod = 1000000000 + 7;

long long modplus(long long a, long long b){
	long long ans = a + b;
	ans %= mod;
	return ans;
}

long long modminus(long long a, long long b){
	long long ans = a - b;
	ans %= mod;
	if(ans < 0) ans += mod;
	return ans;
}

long long modmul(long long a, long long b){
	long long ans = (a % mod) * (b % mod);
	ans = ((ans % mod) + mod) % mod;
	return ans;
}

long long modpow(long long A, long long P){
	long long a = A, p = P;
	if(p == 0) return 1;
	if(p == 1) return a;
	long long adash = modmul(a,a);
	if(p % 2) return modmul(modpow(adash, p / 2), a);
	else return modpow(adash, p / 2);
}

long long moddiv(long long a, long long b){
	long long divisor = modpow(b, mod - 2);
	return modmul(a,divisor);
}

int main(){
	long long N;
	cin >> N;
	if(N == 1)cout << 0 << endl;
	else{
		long long ans = modpow(10, N);
		ans = modminus(ans, modpow(9, N));
		ans = modminus(ans, modpow(9, N));
		ans = modplus(ans, modpow(8, N));
		cout << ans << endl;
	}
}

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

int a(int a, int b){ return a + b;}
int b(int a, int b){ return a - b;}
int c(int a, int b){ return a * b;}
int d(int a, int b){ return a / b;}
int main(){
    char op;
    int x,y;

    for (  ; ; ){
        cin >> x >> op >> y;
        if( op == '?') break;
        if( op == '+') cout << a( x, y) << endl;  
        if( op == '-') cout << b( x, y) << endl; 
        if( op == '*') cout << c( x, y) << endl;  
        if( op == '/') cout << d( x, y) << endl;  
    }
}


Measured memory_bytes: 3096
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> V(N);
    int fsum=0;
    int lsum=0;
    for (int i=0;i<N;i++){
        cin >> V[i];
        lsum+=V[i];
    }
    int pdiff = 1000000;
    for(int i=0;i<N;i++){
        lsum-=V[i];
        fsum+=V[i]; 
        if (abs(lsum - fsum) < pdiff){
            pdiff=abs(lsum-fsum);
        }else{
            cout << pdiff << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))

a, b = max(A), min(A)
for t in [a, b]:
    for i in range(len(A)):
        if A[i] == t:
            A.pop(i)
            break

ans = a-b
for i in range(n-2):
    ans += abs(A[i])
print(ans)

for i in range(n-2):
    if A[i] > 0:
        print(b, A[i])
        b -= A[i]
    else:
        print(a, A[i])
        a -= A[i]
print(a, b)

Measured memory_bytes: 58588
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<numeric>
#include<regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9



int main() {
	int N, Y; cin >> N >> Y;
	Y /= 1000;

	for (int i = 0; i <= N; i++) {
		for (int j = i; j <= N; j++) {
			int n1 = i; // 一万円札の枚数
			int n2 = j - i; // 5千円札の枚数
			int n3 = N - j; // 千円札の枚数

			int tot = 10 * n1 + 5 * n2 + n3;
			if (tot == Y) {
				cout << n1 << " " << n2 << " " << n3 << endl;
				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << " " << -1;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
//何人からもらうのか
		int N = sc.nextInt();
//いくらもらうのか
		double money = 0;
//円かビットコインか
		String u = "";
//答え
		double ans = 0;

		for(int i=0;i<N;i++) {

			money = sc.nextDouble();

			u = sc.next();

			if(u.equals("JPY")){
				ans += money;
			}else if(u.equals("BTC")){
				ans += ( money * 380000.0);
			}
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline void rd(int &x)
{
	x=0;char k=getchar();int s=1;
	while(k>'9'||k<'0'){if(k=='-')s=-1;k=getchar();}
	while(k<='9'&&k>='0')x=x*10+k-48,k=getchar();x*=s;
}
const int N=5e5+10;
int n,m;
int main()
{
	cin>>n;
	cout<<(n-2)*180;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a, b;
  string s;
  cin >> a >> b;
  cin >> s;
  if (s.size() > a + b + 1 || s.at(a) != '-') {
    cout << "No" << endl;
    return 0;
  }
  s.erase(s.begin() + a);
  rep(i, s.size()) {
    if (s.at(i) == '-') {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 200005;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;

int n, a[MAXN], pos[MAXN];
set<int> vis;
vector<int> ans;

int seg[MAXN*4][2], tag[MAXN*4];

int get (int o, int id) {
    return tag[o] ? seg[o][id^1] : seg[o][id];
}

void pull (int o) {
    seg[o][0] = min(get(o<<1, 0), get(o<<1|1, 0));
    seg[o][1] = min(get(o<<1, 1), get(o<<1|1, 1));
}

void push (int o) {
    if (tag[o]) {
        tag[o<<1] ^= 1;
        tag[o<<1|1] ^= 1;
        tag[o] = 0;
    }
}

void build (int o, int l, int r) {
    if (r == l + 1) {
        seg[o][l&1] = a[l];
    } else {
        int mid = (l + r) >> 1;
        build(o<<1, l, mid);
        build(o<<1|1, mid, r);
        pull(o);
    }
}

void flip (int qL, int qR, int o=1, int nL=0, int nR=n) {
    if (nL >= qR || qL >= nR || qL >= qR) {
        return;
    } else if (qL <= nL && nR <= qR) {
        tag[o] ^= 1;
    } else {
        push(o);
        int nM = (nL + nR) >> 1;
        flip(qL, qR, o<<1, nL, nM);
        flip(qL, qR, o<<1|1, nM, nR);
        pull(o);
    }
}

void chg (int x, int o=1, int nL=0, int nR=n) {
    if (nL > x || x >= nR) {
        return;
    } else if (nL == x && nR == x+1) {
        seg[o][0] = seg[o][1] = INF;
    } else {
        push(o);
        int nM = (nL + nR) >> 1;
        chg(x, o<<1, nL, nM);
        chg(x, o<<1|1, nM, nR);
        pull(o);
    }
}

int qry (int qL, int qR, int o=1, int nL=0, int nR=n) {
    if (nL >= qR || qL >= nR || qL >= qR) {
        return INF;
    } else if (qL <= nL && nR <= qR) {
        return tag[o] ? seg[o][1] : seg[o][0];
    } else {
        push(o);
        int nM = (nL + nR) >> 1;
        return min(qry(qL, qR, o<<1, nL, nM), qry(qL, qR, o<<1|1, nM, nR));
    }
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n;
    REP (i, n) {
        cin >> a[i];
        pos[a[i]] = i;
    }

    vis.insert(n);

    memset(seg, INF, sizeof(seg));
    build(1, 0, n);
    REP (i, n/2) {
        int pl = qry(0, n);
        ans.emplace_back(pl);
        pl = pos[pl];
        vis.insert(pl);
        int redg = *vis.lower_bound(pl+1);
        chg(pl);
        flip(pl+1, redg);

        int pr = qry(pl+1, redg);
        ans.emplace_back(pr);
        pr = pos[pr];
        vis.insert(pr);
        chg(pr);
        flip(pr+1, redg);

    }

    REP (i, n) {
        cout << ans[i] << " \n"[i==n-1];
    }


    return 0;
}


Measured memory_bytes: 22644
n=int(input())

a=[]
sum=0
for i in range(n):
    if (i+1)%3==0 and (i+1)%5==0:
        a.append('FizzBuzz')
    elif (i+1)%3==0:
        a.append('Fizz')
    elif (i+1)%5==0:
        a.append('Buzz')
    else:
        a.append(i+1)
        sum=sum+(i+1)

print(int(sum))


Measured memory_bytes: 33460
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
ll A[5],K;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	REP(i,5)cin>>A[i];
	cin>>K;
	cout<<(A[4]-A[0]<=K?"Yay!":":(")<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{   
	int W_t[3];
	int K_t[3];
	int i,p,l,n,m;
    int K_p=0,W_p=0;

	for(i=0;i<3;i++){
		scanf("%d",&p);
		W_t[i]=p;		
	}
	for(i=3;i<10;i++){
		for(l=0;l<2;l++)
			for(m=l+1;m<3;m++){
				if(W_t[l]<W_t[m]){
					n=W_t[l];
					W_t[l]=W_t[m];
					W_t[m]=n;
				}
			}
			scanf("%d",&p);
			if(W_t[2]<p)
				W_t[2]=p;
	}
	for(i=0;i<3;i++){
		scanf("%d",&p);
		K_t[i]=p;		
	}
	for(i=3;i<10;i++){
		for(l=0;l<2;l++)
			for(m=l+1;m<3;m++){
				if(K_t[l]<K_t[m]){
					n=K_t[l];
					K_t[l]=K_t[m];
					K_t[m]=n;
				}
			}
			scanf("%d",&p);
			if(K_t[2]<p)
				K_t[2]=p;
	}
	for(i=0;i<3;i++){
		K_p+=K_t[i];
		W_p+=W_t[i];
	}
	printf("%d %d\n",W_p,K_p);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long LL;
using namespace std;

LL arr[100005];

int main()
{
   int a, b;
   cin >>a >>b;
   for(int i=0;i<a;i++)
   {
       scanf("%lld", &arr[i]);
   }
   sort(arr, arr+a);
   LL ans=0;
   for(int i=0;i<b;i++)
        ans+=arr[i];
        cout <<ans;
    return 0;
}



Measured memory_bytes: 3772
#include<iostream>
using namespace std;
int main(){
	int A;
	int B;
	cin >> A;
	while (1){
		if (A == 0) break;
		for (int i = 0; i < 9; i++){
			cin >> B;
			A -= B;
		}
		cout << A << endl;
		cin >> A;
		
	}
	return 0;
}

Measured memory_bytes: 2936
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
typedef pair <int, int> P;

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

    int n, m;
    cin >> n >> m;

    vector <P> vec(n);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        vec[i] = {a, b};
    }

    sort(vec.begin(), vec.end());

    priority_queue <int> q;
    int index = 0;
    int ans = 0;
    
    for (int day = m - 1; day >= 0; day--) {
        while (index < n && vec[index].first + day <= m) {
            q.push(vec[index].second);
            index++;
        }

        if (!q.empty()) {
            ans += q.top();
            q.pop();
        }
    }

    cout << ans << "\n";
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 2000000000;
constexpr auto MOD = 1000000007;



int main() {
	int n,m;
	cin >> n >> m;
	vs a(n), b(m);

	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];

	bool can = false;
	
	rep(i, n - m + 1)rep(j, n - m + 1) {
		bool same = true;
		rep(k, m)rep(l, m) {
			if (a[i + k][j + l] != b[k][l])same = false;
		}
		if (same) {
			can = true;
			break;
		}
	}

	if (can)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n;
	cin>>s;
	int cnt=1;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1])
			cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3712
H,W,D=map(int,input().split())
if D&1:
  S='RY'*(W+1)
  for i in range(H):
    print(S[i&1:W+(i&1)])
  exit()
x=D>>1
M=max(H,W)<<2
Q=[[0]*(M+1) for j in range(M+1)]
S='RYGB'
for i in range(M+1):
  for j in range(M+1):
    Q[i][j]=((j//x)&1)+((i//(x*2))&1)*2
P=[[0]*W for i in range(H)]
M>>=1
for i in range(H):
  for j in range(W):
    P[i][j]=S[Q[M+i+j][M+((j-i)>>1)]]
for i in range(H):
  print(*P[i],sep='')

Measured memory_bytes: 127116
N,M=map(int, input().split())
L=[]
for i in range(N):
    a,b=map(int, input().split())
    L.append((a,b))
L=sorted(L)

ans=0
now=M
for l in L:
    a,b=l
    ans+=min(b, now)*a
    now-=b
    if now<=0:
        break
print(ans)

Measured memory_bytes: 17804
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

int main(){
ll x,y,i,ans=0;
read(x),read(y);
for (i=x;i<=(y>>1);i*=2) ++ans;
write(ans+1); 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, i, p;
  cin >> N;
  char s, Str[2][4] = {{'P','W','G','Y'},{0,0,0,0}};
  for(i=0;i<N;i++){
    cin >> s;
    p = 0;
    for(int j=0;j<4;j++){
      if(Str[0][j]==s)
        Str[1][j]=1;
      p += Str[1][j];
    }
  }
  cout << ((p-3)?"Four":"Three") << endl;
 
  // ここにプログラムを追記
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
template<class T=ll> 
T in(){T x;cin>>x;return (x);}
template<class T> 
void print(T &x){cout<<x<<"\n";}
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cerr << #x"="<< (x) << "\n"
#define dbgv(x) cerr<<#x<<"\n";reps(y,x){cerr<<y<<" ";}cerr<<"\n"

inline char tc(){
  static char fl[100],*A=fl,*B=fl;
  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  
}
inline int read(){
  int a=0;static char c;
  while((c=tc())<48||c>57);
  while(c>=48&&c<=57)a=a*10+c-48,c=tc();
  return a;
}

int main(){
  ll n=read(),a=read(),b=read(),ans=1e9;
  vector<ll> h(n);
  rep(i,n){
    h[i]=read();
  }
  ll left=1,right=1e9,mid,cnt=0;
  while (right!=left+1) {
    mid =(right+left)/2;
    cnt=0;
    rep(i,n){
      ll temp=h[i]-b*mid;
      if(temp>0){
        cnt+=ceil(1.0*temp/(a-b));
      }
    }
    if(cnt<mid){
      right=mid;
    }else left=mid;
  }
  cnt=0;
  rep(i,n){
    ll temp=h[i]-b*right;
    if(temp>0){
      cnt+=ceil(1.0*temp/(a-b));
    }
  }
  ans=min(ans,max(cnt,right));
  cnt=0;
  rep(i,n){
    ll temp=h[i]-b*left;
    if(temp>0){
      cnt+=ceil(1.0*temp/(a-b));
    }
  }
  ans=min(ans,max(cnt,left));
  cout<<ans<<endl;
  return 0;
}

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

int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(auto&& e: a) 
  {
    cin>>e;
  }

  for (int i = 0; i < min(k,100); ++i)
  {
    vector<int> tmp(n,0);
    for (int j = 0; j < n; ++j)
    {
      int l=max(0,j-a[j]);
      int r=j+a[j]+1;
      tmp[l]+=1;
      if (n>r) tmp[r]-=1;
    }
    for (int i = 0; i < n-1; ++i)
    {
      a[i]=tmp[i];
      tmp[i+1]+=tmp[i];
    }
    a[n-1]=tmp[n-1];
  }
  for(auto&& e: a) 
  {
    cout<<e<<" ";
  }
  cout<<endl;
}

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

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

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

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

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

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

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


map<ll,ll> primes(ll n){
  map<ll,ll> v;
  for (ll i = 2; i*i <= n; ++i) {
    while(n%i==0){
      n/=i;
      v[i]++;
    }
  }
  if(n != 1)v[n]++;
  return v;
}

// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n),b(n);rep(i,n)cin>>a[i]>>b[i];
  sort(all(a));
  sort(all(b));
  int ans = 0;
  if(n%2){
    ans = b[n/2] - (a[n/2]-1);
  }else{
    int ac = a[n/2] + a[n/2-1];
    int bc = b[n/2] + b[n/2-1];
    ans = bc - (ac-1);
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 4836
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n;
ll a[101];
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n)
	cin>>a[i];
	sort(a,a+n);
	int ans=0;
	rep(i,n)
	forn(j,i+1,n)
	forn(k,j+1,n){
		if(a[i]==a[j]||a[j]==a[k])
		continue;
		if(a[i]+a[j]>a[k])
		ans++;
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 3652
def solve(n):
    cands = [6 ** i for i in range(1, 7)] + [9 ** i for i in range(1, 6)]
    m = len(cands)
    dp = [(0, 0)] * (n + 1)
    for i in range(6, n + 1):
        dp[i] = max(
            ((dp[i - cand][0] + cand, dp[i - cand][1] + 1) for cand in cands if i >= cand),
            key=lambda x: (x[0], -x[1])
        )
    return n - dp[n][0] + dp[n][1]

_n = int(input())
print(solve(_n))


Measured memory_bytes: 47172
#include <stdio.h>

int fib(int );
int N[45];

int main(){
  int i;
  scanf("%d",&i);
  printf("%d\n",fib(i));
  return 0;
}

int fib(int a){
  if(a==0||a==1){
    return N[a]=1;
  }
  else {
    if(N[a]!=0){
      return N[a];
    }
  }
  return N[a] = (fib(a-2)+fib(a-1));
}



Measured memory_bytes: 2108
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    ll ans = 0;
    rep(i,1,n+1){
        ll x = n/i;
        ans += i*(x*(x+1)/2);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
typedef long long int ll;

int main() {
    long long N, K; cin >> N >> K;
    vector<long long> v(N);
    for (int i=0; i<N;i++) {
        cin >> v[i];
    }

    ll P = 0;
    for (int i=0; i < v.size()-1; i++) {
        for (int j=i+1; j < v.size(); j++) {
            if (v.at(i) > v.at(j)) P++;
        }
    }
  
    ll Q = 0;
    for (int i=0; i < v.size(); i++) {
        for (int j=0; j < v.size(); j++) {
            if (v.at(i) > v.at(j)) Q++;
        }
    }
  
    long long ans = (P * K) % MOD + (Q * ((K * (K-1) / 2) % MOD) % MOD) ;
    ans %= MOD;

    cout << ans << endl;
}

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()
#define endl "\n"

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

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

    int ssize = s.size();
    int tsize = t.size();

    int ans =  1001;

    rep(i, ssize - tsize + 1){
        int diff = 0;
        rep(j, tsize){
            if(s[i + j] != t[j]) diff++;
        }
        ans = min(ans, diff);
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3584
def calculate():
    S = input().split(" ")
    A = S.count(S[0])
    if A == 2:
        print("Yes")
        return

    B = S.count(S[1])

    if B == 2:
        print("Yes")
        return

    C = S.count(S[2])

    if C == 2:
        print("Yes")

    print("No")

calculate()



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

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;

int main() {
	int A, B;
	cin >> A >> B;
	cout << A - B + 1 << endl;
}


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

#define  ll long long int
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define si(a) a.size()
#define p pair< ll,ll >
#define v vector< ll >
#define vi vector<p>
#define mem(tabl,i) memset(tabl, i, sizeof(tabl))
#define sp(x,y) fixed<<setprecision(y)<<lf(x)
#define debug(c) cout << #c << " = " << c << endl;
#define  f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define Mod 1000000007

const int N = 1e5 + 5;

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

           string s;
           ll n,k,b,c,x,y,z;
           ll counter=0,counter1=0,counter2=0;
           ll sum=0,result=0,ans=0, flag=0;
           cin>>s;
           f(i,0,s.size())
           {
                if(s[i]=='7')
                {
                    flag=1;
                     cout<<"Yes"<<endl;
                     break;
                }
           }
           if(flag==0)
            cout<<"No"<<endl;

}


Measured memory_bytes: 3632
function Main(input) {
  const numbers = input.split(' ').map(n => Number(n));
  const l = numbers[0] + numbers[1];
  const r = numbers[2] + numbers[3];
  if (l > r) {
    console.log('Left');
  } else if (l < r) {
    console.log('Right');
  } else {
    console.log('Balanced');
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200001
#define LIMIT2 500001
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define ffor(i, a, b, c) for(i=(int)(a);i<=(int)(b);i+=(int)c)
#define rep(i, n) for(i=0;i<(int)n;i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define bit(n) (1LL<<(n))
#define median(a, b) (a+b)/2.0
ll swap(ll *a,ll *b){ll tmp;tmp=*a;*a=*b;*b=tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll sum(ll *a,ll n){if(n<=0){return 0;}else{return sum(a,n-1)+a[n-1];}}
ld avg(ll *a,ll n){if(n<=0){return 0;}else return (ld)sum(a,n)/n;};
ld ABS(ld a){if(a>=0){return a;}else{return -a;}}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int stack[LIMIT2];//stack[0]=count;
int queue[LIMIT2];//stack[0]=start,stack[1]=length;
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
//qsort(s,n,sizeof(s[0]),upchar);
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
//qsort(s,n,sizeof(s[0]),downchar);
int push(int n){
    if(stack[0]>=LIMIT2) return -1;
    stack[0]++;
    stack[stack[0]] = n;
    return 1;
}
int pop(){
    if(stack[0]<=0) return -1;
    stack[0]--;
    return stack[stack[0]+1];
}
int enqueue(int n){
    if(queue[0]+queue[1]>=LIMIT2) return -1;
    queue[queue[0]+queue[1]] = n;
    queue[1]++;
    return 1;
}
int dequeue(){
    int result;
    if(queue[1]<=0) return -1;
    result = queue[queue[0]];
    queue[0]++;
    queue[1]--;
    if(queue[1]==0){
        queue[0] = 2;//queue reset
    }else if(queue[1]==1){
        queue[2] = queue[queue[0]];//only oneth
        queue[0] = 2;
    }
    return result;
}
void initialize(){
    stack[0] = 0;//stack size
    queue[0] = 2;//queue start
    queue[1] = 0;//queue length
}

int isKaibun(char *s, int n){
  int i,result=1;
  //rep(i,n) printf("%c",s[i]);
  //printf("\n");
  for(i=0;i<n/2;i++){
    if(s[i]!=s[n-1-i]){
      result=0;
      break;
    }
  }
  return result;
}

int main(void){
    initialize();
    int n,m,p,i,j,l;
    char s[LIMIT1];
    ll a[LIMIT1],b[LIMIT1];
    double result=0.0;
    scanf("%d", &l);
    result = l/3.0;
    printf("%.12f", pow(result, 3.0));
    
    return 0;
}



Measured memory_bytes: 128
#include<stdio.h>

int main(void){

int a,b;

scanf("%d",&a);

scanf("%d",&b);

if(a < b)

{

printf("a < b\n");

}

else{

if(a == b)

{

printf("a == b\n");

}


else

{

printf("a > b\n");

}

}


return 0;

}

Measured memory_bytes: 580