akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int a, b; cin >> a >> b;
  int ans = 0;
  for (int i = a; i <= b; i++) {
    string si = to_string(i);
    string ri = si; reverse(ri);
    if (si == ri) ans++;
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i,N,n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define P(i,j) pair<i,j>
#define MP make_pair
#define MOD 1000000007
typedef long long ll;
typedef long l;
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    string s,t;
    cin>>s>>t;
    //int dp[3002][3002];
    vector<vector<ll>> dp(s.length()+1,vector<ll>(t.length()+1,0));
    crep(i,1,s.length()+1)
    {
        crep(j,1,t.length()+1)
        {
            if(s[i-1] == t[j-1])
            {
                dp[i][j] = dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
            
        }
    }
    V(char) ot;
    ll i=s.length(),j=t.length();
    while(i>0 && j>0)
    {
        if(max(dp[i-1][j],dp[i][j-1]) != dp[i][j])
        {
            ot.push_back(s[i-1]);
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j] == dp[i][j])
                i--;
            else
            {
                j--;
            }
            
        }
        
    }
    reverse(all(ot));
    rep(i,ot.size())
    {
        cout<<ot[i];
    }
    



    

    return 0;
}

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  int a=0,b=0;
  int res=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0')a++;
    if(s[i]=='1')b++;
    if(a>0&&b>0){
      a--;b--;res+=2;
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 512
// Alapan
// IIITH

#include<bits/stdc++.h>
using namespace std;

// data types
#define ll long long int
#define ld long double

//funtion macros


// stl
#define lp(var,start,end) for (ll var = start; var <=end ; ++var)
#define ilp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll>
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))

#define mod 1000000007

// utility functions
ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

ll min(ll a, ll b){
	if(a<b)return a;
    return b;
}

ll power(ll x, ll y, ll m=mod){
	if(y<0){
		x = power(x,m-2);
		y = -y;
	}
	ll ans=1;
	x = x % m;
	while(y){
		if(y&1) ans = (ans*x)%m;
		y=y/2;
		x=(x*x)%m;
	}
	return ans;
}

ll factorial(ll n, ll m=mod){
    ll ans = 1;
	ll i = 1;
    while(i<=n){
        ans = (ans*i)%m;
        i++;
    }
    return ans;
}

///////////////////////////////////////////////////////////

int main(){
    ios_base::sync_with_stdio(false);
    ll x;
    cin >> x;
    cout << !(x) << "\n";
	return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

#define EPS (1e-10)

class Point {
public:
	int x, y;
	Point(int x, int y) :
			x(x), y(y) {
	}
	Point operator -(Point p) {
		return Point(x - p.x, y - p.y);
	}
};

typedef vector<Point> Polygon;

double dot(Point p1, Point p2) {
	return p1.x * p2.x + p1.y * p2.y;
}
double cross(Point p1, Point p2) {
	return p1.x * p2.y - p1.y * p2.x;
}
double norm(Point p) {
	return p.x * p.x + p.y * p.y;
}
double abs(Point p) {
	return sqrt(norm(p));
}

int contains(Polygon g, Point p) {
	int n = g.size();
	bool x = false;
	for (int i = 0; i < n; ++i) {
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) {
			return 1;
		}
		if (a.y > b.y) {
			swap(a, b);
		}
		if (a.y < EPS && EPS < b.y && cross(a, b) > EPS) {
			x = !x;
		}
	}
	return x ? 2 : 0;
}

int main() {

	int n;
	scanf("%d", &n);
	Polygon g;
	for (int i = 0; i < n; ++i) {
		int x, y;
		scanf("%d %d", &x, &y);
		Point p(x, y);
		g.push_back(p);
	}

	int q;
	scanf("%d", &q);
	for (int i = 0; i < q; ++i) {
		int x, y;
		scanf("%d %d", &x, &y);
		Point p(x, y);
		cout << contains(g, p) << endl;
	}
	return 0;
}

Measured memory_bytes: 3228
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        String s = sc.next();
        int[] nums = new int[n];
        for (int i = 0; i < n - 1; i++) {
            nums[i + 1] = nums[i];
            if (s.substring(i, i + 2).equals("AC")) {
                nums[i + 1]++;
            }
            
        }
        
        for (int i = 0; i < q; i++) {
            int l = sc.nextInt() - 1;
            int r = sc.nextInt() - 1;
            
            System.out.println(nums[r] - nums[l]);
        }
    }
}


Measured memory_bytes: 70888
import sys

#+++++
		
def main():
	n,k,q = map(int, input().split())
	aaa=[0]*n
	for i in range(q):
		a = int(input())
		aaa[a-1] += 1
	
	for p in aaa:
		if k-(q-p) > 0:
			print('Yes')
		else:
			print('No')
	return 
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 4680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, c, x, z = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) for (int k = 0; k <= c; k++) if (i * 500 + j * 100 + k * 50 == x) z++;
    cout << z;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define forlist(i, vec) for(auto &&i : vec)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) cerr << #x << ": " << (x) << endl
using namespace std;
typedef long long LL;
typedef long long int64;
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
typedef std::vector<LL> VL;
typedef std::vector<VL> VVL;
typedef std::vector<std::string> VS;
typedef std::pair<int, int> PII;
typedef std::pair<LL, LL> PLL;
typedef std::queue<int> QI;
typedef std::priority_queue<int> PQI;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline void vcinpb(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}

const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
// M_PI 3.1415...

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(a);
    cill(b);
    cill(n);
    LL about = 0;
    if (n > b - 1){
        about = b-1;
    }else{
        about = n;
    }
    LL ans = (about * a) / b - (about / b) * a;
    co(ans);
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    int H[N];
    for(int i=0;i<N;i++){
        cin >> H[i];
        H[i]--;
    }
    bool flag=true;
    for(int i=1;i<N;i++){
        if(H[i]<H[i-1]){
            H[i]++;
            flag &=(H[i]>=H[i-1]);
        }
    }
    if(flag==1){
        cout << "Yes" << endl;
    }else if(flag==0){
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=0;
	cin >>n;
	ans=800*n-(n/15)*200;
	cout<<ans<<endl;
}

Measured memory_bytes: 3596
using System;

namespace ABC064D
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            string S = Console.ReadLine();

            int count = 0;

            for (int i = 0; i < N; i++)
            {
                if (S[i] == '(')
                {
                    count++;
                }
                else if (S[i] == ')')
                {
                    count--;
                }

                if (count < 0)
                {
                    S = '(' + S;
                    count = 0;
                    N++;
                    i++;
                }
            }

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    S += ')';
                }
            }

            Console.WriteLine(S);
        }
    }
}


Measured memory_bytes: 11092
n,m,x=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(n)]
import itertools
sum_min=10**7
for i in itertools.product([0,1],repeat=n):
    level=[0]*m
    for j in range(m):
        level[j]=sum(i[k]*c[k][j+1] for k in range(n))
    for l in range(m):
        if level[l]<x:
            break
    else:
        sum_min=min(sum_min,sum(i[k]*c[k][0] for k in range(n)))
print(sum_min if sum_min!=10**7 else -1)

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

int main(){
	int m=100000,n;
	cin>>n;
	for(int i=0;i<n;i++){
		m=m/20*21;
		m+=(1000-(m-1)%1000)-1;
	}
	cout<<m<<endl;
	return 0;
}



Measured memory_bytes: 3120
import itertools

MOD = 10 ** 9 + 7
n, k = map(int, input().split())

def solve(a, b):
    c = (b + a) * (b - a + 1) // 2
    return c

ans = 0
x = n
while x >= k - 1:
    a = solve(0, x)
    b = solve(n - x, n)
    ans += b - a + 1
    ans = ans % MOD
    x -= 1
print(ans)


Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		if(N%sumDegit(N)==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	static int sumDegit(long N) {
		int i = 0;
		long tmp = N;
		while(tmp>=10) {
			i += tmp % 10;
			tmp = tmp / 10;
		}
		i += tmp;
		return i;
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  bool ok = false;
  rep(i, 3) {
    int t = n % 10;
    if(t == 7) ok = true;
    n /= 10;
  }
  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
long long K; 
cin>>N>>K;
vector<int>vec(N);
vector<bool>wtf(N);
vector<int>hozon(N);
for(int i=0; i<N; i++){
cin>>vec.at(i);
}
int h=0;
int count=0;
int s=1;
for(int i=0; i<N; i++){
if(wtf.at(s-1)==false){
wtf.at(s-1)=true;
hozon.at(s-1)=count;
s=vec.at(s-1);
count++;
}
else{
h=count-hozon.at(s-1);//一回のループ量
//hozonは最初にそこに着くまでの回数
break;
}
}
int y=0;
if(hozon.at(s-1)<K){
y=(K-hozon.at(s-1))%h+hozon.at(s-1);
}
else{
y=K;
}
int answer=1;
for(int i=0; i<y; i++){
answer=vec.at(answer-1);
}
cout<<answer<<endl;
}


Measured memory_bytes: 4844
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>
#include <queue>
#include <stack>
#include <cassert>
 

using namespace std;

char nth_letter(long long n)
{
    assert(n >= 1 && n <= 26);
    return "abcdefghijklmnopqrstuvwxyz"[n-1];
}

int main() {
    long long l, r, d;
    cin >> l >> r >> d;
    long long ans1, ans2;
    ans1 = l/d;
    ans2 = r/d;
    if(l%d==0){
        ans1-=1;
    }
    cout << ans2-ans1 << endl;
    
    
    
    return 0;
 }


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;

struct res {
  string city;
  int point;
  int id;
  res(string c, int p, int i) {
    city = c;
    point = p;
    id = i;
  }
};

bool comp(const res &a, const res &b) {
  if (a.city == b.city)
    return a.point > b.point;
  return a.city < b.city;
}

int main()
{
  // 入力
  int n;
  cin >> n;
  vector<res> r;
    
  for (int i = 1; i <= n; i++) {
    string s;
    int p;
    cin >> s >> p;
    r.push_back(res(s, p, i));
  }
  sort(r.begin(), r.end(), comp);
  
  // 出力
  for (int i = 1; i <= n; i++) {
  	cout << r.at(i-1).id << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
//Candles

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,k;cin>>n>>k;
    vecrep(n,a,int);
    int ans = inf;
    rep(i,0,n-k+1)ans=min(ans,a[i+k-1]-a[i]+min(abs(a[i+k-1]),abs(a[i])));
    cout<<ans<<nnn;
    return 0;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

int main(){
    int N, K; cin >> N >> K;
    vi H(N);
    for(auto &x : H) cin >> x;
    sort(all(H));
    ll res=0;
    for(int i=0; i<N-K; i++){
        res+=H[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4036
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;

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


void solve() {
	ll n; cin >> n;
	string str; cin >> str;

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		bool ng = false;
		if (str[i] != '.') {
			ng = true;
		}

		int cou = 0;
		for (int j = i + 1; j < n; j++) {
			if (str[j] == 'B') {
				cou++;
				break;
			}
			else if (str[j] == 'W') {
			}
			else {
				break;
			}
		}

		for (int j = i - 1; j >= 0; j--) {
			if (str[j] == 'B') {
				cou++;
				break;
			}
			else if (str[j] == 'W') {
			}
			else {
				break;
			}
		}
		if (cou == 2)ng = true;

		if (ng)continue;

		ll now = 0;
		ll tmp = 0;
		for (int j = i + 1; j < n; j++) {
			if (str[j] == 'B') {
				tmp++;
			}
			else if (str[j] == 'W') {
				now += tmp;
				break;
			}
			else {
				break;
			}
		}

		tmp = 0;
		for (int j = i - 1; j >= 0; j--) {
			if (str[j] == 'B') {
				tmp++;
			}
			else if (str[j] == 'W') {
				now += tmp;
				break;
			}
			else {
				break;
			}
		}

		ans = max(ans, now);
	}

	cout << ans << endl;
		
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 3216
import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=list(map(int,input().split()))
    B=[0]*N
    for i in range(N):
        B[i]=A[i]-(i+1)
    val=np.median(B)

    ans=0
    for i in range(N):
        ans+=abs(val-B[i])
    print(int(ans))

    

    
resolve()

Measured memory_bytes: 34188
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define PI 3.1415926535
 
 
int main()
 {
	int a,b,h,m;
	double answer,deg,adeg,bdeg,rad;
	
	scanf("%d%d%d%d",&a,&b,&h,&m);

	adeg=30.0*h+m*0.50;
	
	bdeg=6.0*m;

	deg=fabs(adeg-bdeg);

	rad=deg*(PI/180.0);
	
	answer=sqrt(a*a+b*b-2.0*a*b*cos(rad));

	printf("%.10lf",answer);

			return 0;
	}


	







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

int main(){
    using namespace std;
    constexpr unsigned long C = 26;
    unsigned long D;
    cin >> D;
    vector<unsigned long> c(C);
    for(auto&& i : c)cin >> i;
    vector v(D, vector<unsigned long>(C));
    for(auto&& i : v)for(auto&& j : i)cin >> j;

    reverse(begin(v), end(v));

    vector<unsigned long> last(C);
    vector<unsigned long> ans(D);

    for(unsigned long i{0}; i < D; ++i){
        unsigned long mx{0}, mxi{0};
        for(unsigned long j{0}; j < C; ++j){
            unsigned long tmp{v[i][j] + c[j] * (i + 1 - last[j])};
            if(tmp > mx){
                mx = tmp;
                mxi = j;
            }
        }
        ans[i] = mxi;
        last[mxi] = i + 1;
    }

    reverse(begin(ans), end(ans));

    for(const auto& i : ans)cout << i + 1 << endl;

    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
 
int main(void)
{
	int S;
	cin >> S;
	int lower = S % 100;
	int upper = S / 100;
	bool yymm = (lower >= 1 && lower <= 12);
	bool mmyy = (upper >= 1 && upper <= 12);
 
	if (yymm&&mmyy)cout << "AMBIGUOUS" << endl;
	else if (yymm)cout << "YYMM" << endl;
	else if (mmyy)cout << "MMYY" << endl;
	else cout << "NA" << endl;
 
	return 0;
}

Measured memory_bytes: 256
import math
A, B, H, M = [int(i) for i in input().split()]
thetah = 30 * H + 0.5 * M
thetam = 6 * M
theta = abs(thetah - thetam)
C2 = A*A + B*B - 2*A*B*math.cos(math.pi * theta/180 )
print(math.sqrt(C2))

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

int main(){
	int a, b, c;
	cin >> a >> b;
	c = a * b;

	if(c % 2 == 0){
  		cout << "Even" << endl;
	}
	else{
  		cout << "Odd" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;
static const ll max_n = 110;
vector<ll> clocks(max_n);

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

ll lcm(ll a, ll b){
    ll g = gcd(a, b);
    g = b / g;
    return a * g;
}

int main(){
    ll N, t;
    scanf("%lld", &N);
    ll lcm_num = 1;
    for(ll i=0;i<N;i++){
        scanf("%lld", &t);
        clocks[i] = t;
        lcm_num = lcm(lcm_num, t);
        
    }
    ll ans = lcm_num;
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

struct UFTree(T)
{
    struct Node
    {
        T parent;
        T rank = 1;
    }

    this(T n)
    {
        nodes.length = n;
        foreach (i, ref node; nodes) node = Node(i.to!T);
    }

    void unite(T a, T b)
    {
        a = root(a);
        b = root(b);

        if (a == b) return;

        if (nodes[a].rank < nodes[b].rank) {
            nodes[b].parent = nodes[a].parent;
        } else {
            nodes[a].parent = nodes[b].parent;
            if (nodes[a].rank == nodes[b].rank) nodes[a].rank += 1;
        }
    }

    bool is_same(T a, T b)
    {
        return root(a) == root(b);
    }

private:
    Node[] nodes;

    T root(T i)
    {
        if (nodes[i].parent == i) return i;

        return nodes[i].parent = root(nodes[i].parent);
    }
}

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    auto PS = readln.split.to!(int[]);

    auto uf = UFTree!int(N);
    foreach (_; 0..M) {
        auto xy = readln.split.to!(int[]);
        uf.unite(xy[0]-1, xy[1]-1);
    }

    int cnt;
    foreach (i, p; PS) {
        if (uf.is_same(i.to!int, p-1)) ++cnt;
    }

    writeln(cnt);
}

Measured memory_bytes: 5308
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	int tot = 100000;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		long double now = 0.05 * tot;
		for(int j = 5000;; j += 1000){
			if(j >= now){
				tot += j;
				break;
			}
		}
	}
	cout << tot << '\n';
	return 0;
}
// Write Here



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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    ll H, W;
    cin >> H >> W;

    if (H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }

    ll ans = (W/2)*(H/2)+((W+1)/2)*((H+1)/2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

static char const *
solve(int N)
{
  for (int n = 0; n <= N; n += 7)
  {
    if ((N - n) % 4 == 0)
    {
      return "Yes";
    }
  }
  return "No";
}

int
main()
{
  int N;
  cin >> N;
  cout << solve(N) << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();

    let max = min(a, b);

    let min = if a + b > n {
        a + b - n
    } else {
        0
    };

    return format!("{} {}", max, min);
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string s;
  cin >> s;
  VEC<int> wb(s.length());
  REP(i, 0, s.length()) {
    if (s[i] == '1')
      wb[i] = 1;
    else
      wb[i] = 0;
  }
  int b1 = 0, b0 = 0;
  bool b1n = 1, b0n = 0;
  REP(i, 0, s.length()) {
    if (wb[i] != b1n) {
      b1++;
    }
    if(wb[i]!=b0n){
      b0++;
    }
    b1n=!b1n;
    b0n=!b0n;
  }
  cout<<min(b1,b0)<<endl;

  return 0;
}


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

using namespace std;

typedef pair<int,int> ii;

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> from(n), to(n);
  to[0] = (s[0] == '1');
  from[n - 1] = (s[n - 1] == '1');
  for (int i = 1; i < n; i++) to[i] = (s[i] == '1') ? to[i - 1] + 1 : 0;
  for (int i = n - 2; i >= 0; i--) from[i] = (s[i] == '1') ? from[i + 1] + 1 : 0;
  
  vector<vector<int>> blocks(n);
  for (int i = 1; i < n - 1; i++) {
    if (s[i] == '0' && s[i - 1] == '1' && s[i + 1] == '1') {
      for (int j = 1; j <= to[i - 1]; j++) {
        blocks[i + 1].push_back(j);
      }
      for (int j = 1; j <= from[i + 1]; j++) {
        blocks[i + j].push_back(j);
      }
    } 
  }

  vector<int> dp(n);
  for (int i = 1; i < n; i++) {
    dp[i] = dp[i - 1];
    for (int b : blocks[i]) {
      if (i - b - 2 >= 0) dp[i] = max(dp[i], dp[i - b - 2] + b);
      else dp[i] = max(dp[i], b);
    }
  }
  cout << dp[n - 1] << endl;

  return 0;
}


Measured memory_bytes: 36636
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

ll lcm(ll a,ll b){
	return a * b / gcd(a,b);
}

ll solve1(ll l,ll r){
	vector<ll> vec;
	bool check[2019] = {false};
	
	rep(i,0,min(r-l+1,(ll)2019)){
		check[(l+i) % 2019] = true;
	}
	
	rep(i,0,2019){
		if(check[i] && vec.size() < 2) vec.push_back(i);
	}
	
	return ((vec[0] * vec[1]) % 2019);
}


ll solve2(ll l,ll r){
	ll ans = LINF;

	if(r-l > 2019){
		return 0;
	}
	else{
		rep(i,l,r){
			rep(j,i+1,r+1){
				ans = min(ans,(i*j) % 2019);
			}
		}
		return ans;
	}

}



signed main(){
	ll l,r;
	cin >> l >> r;
	
	cout << solve2(l,r) << endl;
	
    return 0;
}

Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    P,Q,R = LMIIS()
    print(min(P+Q,Q+R,R+P))
    
main()

Measured memory_bytes: 65408
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <deque>
using namespace std;

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

	long double n;
	cin >> n;

	cout << fixed << setprecision(7) << pow(n / 3, 3) << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int t;
    int n;
    int x;
    int prev;
    int[] ud;

    void run(){
	while(sc.hasNext()){
	    t = sc.nextInt();
	    while(t>0){
		t--;
		n = sc.nextInt();
		ud = new int[n-1];
		prev = sc.nextInt();
		for(int i=0; i<ud.length; i++){
		    x = sc.nextInt();
		    ud[i] = x-prev;
		    prev = x;
		}
		Arrays.sort(ud);
		int max = ud[ud.length-1]<0 ? 0:ud[ud.length-1];
		int min = ud[0]>0 ? 0:Math.abs(ud[0]);
		System.out.println(max+" "+min);
	    }
	}
    }
}
		    

Measured memory_bytes: 27792
from itertools import product
import copy
H,W,K = map(int,input().split())
C_ary = [[_ for _ in input()] for j in range(H)]
patrn_h = []
patrn_w = []
cntup = 0
for i in product([0,1], repeat = H):
    patrn_h.append(i)
for i in product([0,1], repeat = W):
    patrn_w.append(i)
for i in patrn_h:
    for j in patrn_w:
        fnl_cnt = 0
        test_ary = copy.deepcopy(C_ary)
        for h in range(H):
            cnt = 0
            for w in range(W):
                if i[h] == 0 or j[w] == 0:
                    test_ary[h][w] = "."
            cnt = test_ary[h].count("#")
            fnl_cnt += cnt
        if fnl_cnt == K:
            cntup += 1
print(cntup)

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

#define max 1000

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    long int a, b;
    
    scanf("%ld %ld", &a, &b);
    
    if ((a+b)%2==0) {
        printf("%ld", (a+b)/2);
    } else {
        printf("IMPOSSIBLE");
    }
    
    return 0;
}



Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
n,h = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(n)]

a_max = max(a for a,b in AB)
B = [b for a,b in AB if b>a_max]
B.sort(reverse=True)
ans = 0

for b in B:
    if h<=0:
        break
    ans+=1
    h-=b
if h>0:
    ans+=(h+a_max-1)//a_max
print(ans)

Measured memory_bytes: 28148
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int d = sc.nextInt();
        
        int[][] x = new int[n][d];
        for(int a = 0; a < n; a++){
            for(int b = 0; b < d; b++){
                x[a][b] = sc.nextInt();
            }
        }
        
        int ans = 0;
        for(int a = 0; a < n-1; a++){
            for(int c = 1; c < n-a; c++){
                double distance = 0;
                for(int b = 0; b < d; b++){
                    distance += (x[a][b] - x[a+c][b]) * (x[a][b] - x[a+c][b]);
                }
                distance = Math.sqrt(distance);
                if(distance == Math.floor(distance)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
from collections import defaultdict
import random

import sys
sys.setrecursionlimit(100000000)

# N, W = 100, 20000
# W_V = [[random.randint(1,1000000), random.randint(1,1000)] for i in range(N)]
N = int(raw_input())
ADG_VERTICES= defaultdict(list)
panting_cache = {}
for i in range(N-1):
    u, v = map(int, raw_input().split())
    ADG_VERTICES[u].append(v)
    ADG_VERTICES[v].append(u)

BLACK_COLOR = 1
WHITE_COLOR = 0
MOD_VAL = int(1e9 + 7)
def get_ways_to_paint_vertices(parent_color, parent_vertex, vertex):
    if ADG_VERTICES[vertex] == [parent_vertex]:
        if parent_color == BLACK_COLOR:
            return 1
        else:
            return 2

    if (parent_color,  parent_vertex, vertex) in panting_cache:
        return panting_cache[parent_color,  parent_vertex, vertex]
    ans1 = 1
    ans2 = 0
    for adg_vertex in ADG_VERTICES[vertex]:
        if adg_vertex != parent_vertex:
            ans1 = (ans1 * get_ways_to_paint_vertices(WHITE_COLOR, vertex, adg_vertex)) % MOD_VAL
    if parent_color != BLACK_COLOR:
        ans2 = 1
        for adg_vertex in ADG_VERTICES[vertex]:
            if adg_vertex != parent_vertex:
                ans2 = (ans2 * get_ways_to_paint_vertices(BLACK_COLOR, vertex, adg_vertex)) % MOD_VAL

    ans = ans1 + ans2
    if ans >= MOD_VAL:
        ans -= MOD_VAL
    panting_cache[parent_color, parent_vertex, vertex] = ans

    return ans


print get_ways_to_paint_vertices(None, 0, 1)


Measured memory_bytes: 115852
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    vector<int> l(n, 0);
    rep(i, n) cin >> l[i];

    ll ans = 0;
    sort(l.begin(), l.end());
    rep(i, n) {
        for (int j = i + 1; j < n; j++) {
            int a_plus_b = l[i] + l[j];
            int left = j + 1;
            int right = n;
            while (left != right) {
                int middle = (left + right) / 2;
                if (a_plus_b <= l[middle]) {
                    right = middle;
                }
                else {
                    if ((right - left) == 1) left = right;
                    else left = middle;
                }
            }
            ans += ll(left - j - 1);
        }
    }
    cout << ans << endl;
    return 0;
}

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;
typedef long long int lli;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


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

	cout << 2.0 * 3.141592*r << endl;
	



}

Measured memory_bytes: 3784
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

int main(void) {
    int n, m;
    cin >> n >> m;
    
    int a[n][m];
    int b[m];
    int c[n];

    int i, j, k;
    
    //input a
    for(i=0; i<n; i++) {
        for(j=0; j<m; j++) {
            cin >> a[i][j];
        }
    }
    
    //input b
    for(i=0; i<m; i++) {
        cin >> b[i];
    }
    
    //initialize c
    for(i=0; i<n; i++) {
            c[i] = 0;
    }
    
//    //test display
//    for(i=0; i<n; i++) {
//        for(j=0; j<m; j++) {
//            cout << a[i][j] << " ";
//        }
//        cout << endl;
//    }
//    
//    for(i=0; i<m; i++) {
//        cout <<  b[i] << endl;
//    }
    

    //calculation
    for(i=0; i<n; i++) {
        for(j=0; j<m; j++) {
            c[i] += a[i][j]*b[j];
        }
    }
    
    //display c
    for(i=0; i<n; i++) {
        cout << c[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n; cin >> n; vl ti(n);
  
  rep(i,n){
    ll x; cin >> x;
    ti.at(x-1) = i+1;
  }
  
  rep(i,n) cout << ti.at(i) << ' ' ;
  
  cout << endl;
}

Measured memory_bytes: 1664
'use strict'
const inputs = require('fs').readFileSync(0, 'utf8').split(' ')
const n = inputs[0]
const y = inputs[1]
for (let j = 0;j <= 8;j++) {
  const remain = y - 5000 * j
  if (remain < 0) break
  const man = (remain - 1000 * (n - j)) / 9000
  if (Number.isInteger(man) && man >= 0 && n - j - man >= 0) return console.log(man, j, n - j - man)
}
return console.log(-1, -1, -1)

Measured memory_bytes: 7628
#include <iostream>
using namespace std;
int main(void){
    int H,W,h,w,whole,black,white;
    cin >> H >> W;
    cin >> h >> w;
    
    whole = H * W;
    black = whole - (h * W);
    white = black - (w * (H - h));
    cout << white;
    
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]

for i, a in enumerate(A[::-1]):
    ind = N - i
    if ind > N//2:
        ans[ind-1] = a
    else:
        cnt = 0
        for j in range(2, (N // ind) + 1):
            cnt += ans[j * ind - 1]
        if cnt % 2 == A[ind-1]:
            ans[ind-1] = 0
        else:
            ans[ind-1] = 1

print(sum(ans))
for i, a in enumerate(ans):
    if a == 1:
        print(i+1, end="")
        print(' ', end="")


Measured memory_bytes: 8784
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
//#define __int64 long long
#define P pair<int,int>
int g[111][111];
int is[111][111];
bool ok[111][111];
int n,m;
int a,b,c;
vector<P>edge;
const int INF=1000000000;
int main(){
	cin>>n>>m;
	rep(i,n)rep(j,n)g[i][j]=(i==j)?0:INF;

	rep(i,m){
		cin>>a>>b>>c;
		a--;b--;
		g[a][b]=c;
		g[b][a]=c;
		is[a][b]=is[b][a]=c;
		edge.push_back(mp(a,b));
	}
	
	rep(k,n){
		rep(i,n){
			rep(j,n)g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
		}
	}


	rep(k,n){
		rep(i,n){
			rep(j,n)if(is[i][k]+g[k][j]==g[i][j])ok[i][k]=ok[k][i]=1;
		}
	}
	int ans=0;
	rep(i,n){
		for(int j=i+1;j<n;j++)if(is[i][j]&&!ok[i][j])ans++;
	}		
	cout<<ans<<endl;
	
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair < int , int > Pi;
//親が繋げているノードのANDをとることで処理ができる(何個つながっているのか)
struct UF
{
    int parent[200005];
    int size[200005];
    UF() { for(int i = 0; i < 200005; i++) parent[i] = i, size[i] = 1; }
    int root(int n) { return parent[n] = (parent[n] == n ? n : root(parent[n])); }
    void unite(int a, int b) { a = root(a), b = root(b); parent[a] = b; size[b] += size[a]; }
    int get_size(int n) { return (size[root(n)]); }
};
UF tree1, tree2;
int main()
{
    int N, K, L;
    map < Pi , int > mp;
    cin >> N >> K >> L;
    for(int i = 0; i < K; i++) {
        int a, b;
        cin >> a >> b; --a, --b;
        tree1.unite(a, b);
    }
    for(int i = 0; i < L; i++) {
        int a, b;
        cin >> a >> b; --a, --b;
        tree2.unite(a, b);
    }
    for(int i = 0; i < N; i++) mp[Pi(tree1.root(i),tree2.root(i))]++;
    for(int i = 0; i < N; i++) {
        cout << mp[Pi(tree1.root(i), tree2.root(i))];
        if(i < N - 1) cout << " ";
        else cout << endl;
    }
    return (0);
}


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

using namespace std;
struct pp
{
    double x,y;
}a[10];
int main()
{
    int n;
    double s=0,num=1,num2=1;
    cin>>n;
    for(int i=n-1;i>=1;i--)
    {
        num2*=i;
    }
    for(int i=n;i>=1;i--)
    {
        num*=i;
    }
    for(int i=0;i<n;i++)
        cin>>a[i].x>>a[i].y;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            s+=sqrt((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y));
        }
    }
    printf("%.10lf",s/num*num2*2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
    ll ans = ll(INF);
    rep(i, x+1) {
        // Aピザの枚数
        int buy_a = i;
        // ABピザの枚数
        int buy_ab = (x-i) * 2;
        int buy_b = max(0, y - (x-i));
        ans = min(ans, ll(buy_a*a+buy_b*b+buy_ab*c));
    }
    rep(i, y+1) {
        // Bピザの枚数
        int buy_b = i;
        // ABピザの枚数
        int buy_ab = (y-i) * 2;
        int buy_a = max(0, x - (y-i));
        ans = min(ans, ll(buy_a*a+buy_b*b+buy_ab*c));
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);i++)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
#define int long long
using namespace std;

signed main(){
    int a, b;
    cin >> a >> b;
    cout << max(0LL, a-b) << endl;
    return 0;
}


Measured memory_bytes: 256
inputs  = list(map(int, input().strip().split(' ')))
l1 = set(range(inputs[0],min(inputs[0]+inputs[2],inputs[1]+1)))
l2 = set(range(max(inputs[1]-inputs[2]+1,inputs[0]),inputs[1]+1))
returnList = sorted(list(set().union(l1,l2)))
for l in returnList :
    print(l)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
const int N = 1e3 + 5;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Abs(T a) { return a > 0 ? a : -a; }
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
char s[N];
int n, m, x[N], y[N], len[N];
signed main() {
	n = read();
	for(int i = 1; i <= n; ++ i) x[i] = read(), y[i] = read();
	int tmp = Abs(x[1] + y[1]) & 1;
	for(int i = 2; i <= n; ++ i) if((Abs(x[i] + y[i]) & 1) != tmp) return puts("-1"), 0;
	len[1] = 1; m = 1; printf("%d\n1", 32 - tmp);
	if(tmp) for(int i = 1; i <= 30; ++ i) printf(" %d", len[++ m] = (1 << i));
	else for(int i = 0; i <= 30; ++ i) printf(" %d", len[++ m] = (1 << i));
	puts("");
	for(int i = 1, nx, ny; i <= n; ++ i) {
		nx = 0; ny = 0;
		for(int j = m, dx, dy; j; -- j) {
			dx = x[i] - nx; dy = y[i] - ny;
			if(Abs(dx) > Abs(dy)) {
				if(dx > 0) nx += len[j], s[j] = 'R';
				else nx -= len[j], s[j] = 'L';
			}
			else {
				if(dy > 0) ny += len[j], s[j] = 'U';
				else ny -= len[j], s[j] = 'D';
			}
		}
		printf("%s\n", s + 1);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<vector<int>> A(N, vector<int>(N));
  REP(i, N) REP(j, N) cin >> A[i][j];

  REP(k, N) REP(i, N) REP(j, N){
    if(A[i][j] > A[i][k]+A[k][j]) {
      cout << -1 << endl;
      return 0;
    }
  }

  vector<pair<int, pair<int, int>>> vec;
  REP(i, N) FOR(j, i+1, N){
    vec.emplace_back(make_pair(A[i][j], make_pair(i, j)));
  }
  
  sort(ALL(vec));

  vector<vector<int>> dist(N, vector<int>(N, INF));
  REP(i, N) dist[i][i] = 0;

  int ans = 0;
  REP(k, vec.size()){
    int u = vec[k].second.first;
    int v = vec[k].second.second;
    int d = vec[k].first;

    if(dist[u][v] != A[u][v]){
      ans += d;
      dist[u][v] = d;
      dist[v][u] = d;

      REP(i, N) REP(j, N){
        chmin(dist[i][j], dist[i][u]+dist[v][j]+d);
        chmin(dist[i][j], dist[i][v]+dist[u][j]+d);
      }
    }
  }
  
  cout << ans << endl;

  return 0;
}

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

using namespace std;

int main(){
    string col, wro;
    cin >> col;

    cin >> wro;

    int ans=0;

    for (int i = 0; i < (col.length());i++){
        if(*(col.c_str()+i)!=*(wro.c_str()+i)){
            ans++;
        }
    }

        cout << ans << endl;
}

Measured memory_bytes: 3928