akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const int N = 20;
const int K = 17712;
const ll mod = 100000;

int mask;

char m[N][N];
map<int,int> M;
int memo[20][20][K];


inline int getIndex(int st)
{
	int index = M.size();
	if (M.find(st) == M.end()) M[st] = index;
	return M[st];
}

int rec(int &h, int &w, int now, int st)
{
	if(w * h == now) return 1;
	int index = getIndex(st);
	
	int y = now / w, x = now % w;
	if(memo[y][x][index] != -1) return memo[y][x][index];
	
	ll res = 0;
	
	// J
    if (m[y][x] == '?' || m[y][x] == 'J')
	{
		int next = st;
		if (next % 2 == 1) next = ((next - 1) << 1) | 1; // (next << 1) & (~2) | 1
		else next = (next << 1) | 1;
		
		res = (res + rec(h, w, now + 1, next & mask)) % mod;
    }
	
	// O
    if (m[y][x] == '?' || m[y][x] == 'O')
	{
		int next = st;
		next = (next << 1);
		
		res = (res + rec(h, w, now + 1, next & mask)) % mod;
    }
	
	// I
    if (m[y][x] == '?' || m[y][x] == 'I')
	{
		if (((1 << (w - 1)) & st) == 0 || x == w - 1)
		{
			int next = st;
			if (st % 2 == 1) next = (next - 1) << 1;
			else next = (next << 1);
			
			res = (res + rec(h, w, now + 1, next & mask)) % mod;
		}
    }
	
	return memo[y][x][index] = res;
}

int main()
{
    int h, w;
	while(cin >> h >> w && h)
	{
		ll all = 1;
		
		rep(i, h) cin >> m[i];
		rep(y, h) rep(x, w)if (m[y][x] == '?') all = (all * 3) % mod;
		rep(k, K) rep(y, h) rep(x, w) memo[y][x][k] = -1;
		
		mask = (1 << w) - 1;
		
		ll cans = rec(h, w, 0, 0);
		ll ans = (all - cans + mod) % mod;
		
		cout << ans << endl;
	}
}

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


int main(){
	int h,w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i,h) cin >> s[i];
	
	rep(i,h){
		rep(j,w){
			if(s[i][j] == '#') {
				cout << s[i][j];
				continue;
			}
			int count = 0;
			for (int k = -1; k <= 1; ++k) {
				for (int l = -1; l <= 1; ++l) {
					if(k == 0 && l == 0) continue;
					int ny = i + k;
					int nx = j + l;
					if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
					if(s[ny][nx] == '#') count++;
				}
			}
			cout << count;
		}
		cout << endl;
	}
    return 0;
}



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

using namespace std;

int N, M, D;
char MapData[100][100];
int DpLenR[101][101], DpLenC[101][101];

int solve() {
	int total;

	for (int i = 0; i < N; ++i) {
		for (int j = M - 1; j >= 0; --j) {
			DpLenR[i][j] = DpLenR[i][j + 1] + 1;
			if (MapData[i][j] == '#') {
				DpLenR[i][j] = 0;
			}
		}
	}

	for (int j = 0; j < M; ++j) {
		for (int i = N - 1; i >= 0; --i) {
			DpLenC[i][j] = DpLenC[i + 1][j] + 1;
			if (MapData[i][j] == '#') {
				DpLenC[i][j] = 0;
			}
		}
	}

	total = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			if (DpLenR[i][j] >= D) {
				++total;
			}
			if (DpLenC[i][j] >= D) {
				++total;
			}
		}
	}

	return total;
}

int main() {

	memset(DpLenR, 0, sizeof(DpLenR));
	memset(DpLenC, 0, sizeof(DpLenC));
	cin >> N >> M >> D;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			cin >> MapData[i][j];
		}
	}
	cout << solve() << endl;
	
	return 0;
}


Measured memory_bytes: 3156
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(4);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void solve(){
    ll n;
    cin>>n;
    V<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    reverse(all(a));
    V<ll> bases;
    string s;
    cin>>s;
    reverse(all(s));
    for(int i=0;i<n;i++){
        for(ll base:bases){
            chmin(a[i],a[i]^base);
        }
        if(a[i]){
            if(s[i]=='0'){
                bases.push_back(a[i]);
            }else{
                cout<<1<<"\n";
                return;
            }
        }
    }
    cout<<0<<"\n";
}
int main(){
    int t;
    cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;

int main() {
  	int H, W;
	cin>>H>>W;
  	vector<vector<char> > grid(H, vector<char>(W));
  	for(int i=0;i<H;i++) {
    	for(int j=0;j<W;j++) {
        	cin>>grid[i][j];
        }
    }
  
  	vector<vector<long long> > dp(H, vector<long long>(W, 0));
  	dp[H-1][W-1] = 1;
  
  	// fill last column
	for(int i=H-2;i>=0;i--) {
    	dp[i][W-1] =
          grid[i][W-1] == '#'? 0:dp[i+1][W-1];
    }
  	// fill last row
	for(int j=W-2;j>=0;j--) {
    	dp[H-1][j] = 
          grid[H-1][j] == '#'? 0:dp[H-1][j+1];
    }
	
  	for(int i=H-2;i>=0;i--) {
    	for(int j=W-2;j>=0;j--) {
        	dp[i][j] = 
              grid[i][j]=='#'?0: (dp[i+1][j]+dp[i][j+1]) % MOD;
        }
    }

  	cout<<dp[0][0] % MOD;
  	return 0;
}

Measured memory_bytes: 9088
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;


public class Main {


    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);
    static boolean debug = false;


    static void solve() {
        int n = in.nextInt();
        int[] a = new int[n*2];
        for(int i=0;i<2*n;i++){
            a[i] = in.nextInt();
        }
        long[][] dp = new long[n+1][n+1];
        for(int i=1;i<n;i++){
            for(int j=0;j<n-i;j++){
                long x = Integer.MAX_VALUE/2;
                for(int k=0;k<i;k++){
                    x = Math.min(x,dp[j][j+k]+dp[j+k+1][j+i]+a[2*j]*a[2*(j+k)+1]*a[2*(j+i)+1]);
                }
                dp[j][j+i] = x;
            }
        }
        out.println(dp[0][n-1]);
    }


    public static void main(String[] args) {
        debug = args.length > 0;
        long start = System.currentTimeMillis();


        solve();
        out.flush();


        long end = System.currentTimeMillis();
        dump((end-start) + "ms");
        in.close();
        out.close();
    }


    static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 26556
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      s: chars,
    }

    let n = s.len();
    let mut cur = 0;
    let mut ans = 0;
    while cur < n {
        // debug!(cur, ans);

        if cur == n-1 {
            ans += 1;
            // cur += 1;
            break;
        }

        if s[cur] != s[cur+1] {
            ans += 1;
            cur += 1;
        } else {
            // 同じ
            if cur+1 == n-1 {
                ans += 1;
                break;
            } else {
                ans += 2;
                cur += 3;
            }
        }
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        System.out.println(S / 3600 + ":" + S % 3600 / 60 + ":" + S % 60);
    }
}


Measured memory_bytes: 26300
package main

import (
	"fmt"
	"math"
)

func main() {
	var x int
	fmt.Scan(&x)

	for i := x; i <= 100003; i++ {
		ok := true
		for j := 2; j <= int(math.Sqrt(float64(i))); j++ {
			if i%j == 0 {
				ok = false
				break
			}
		}
		if ok {
			fmt.Println(i)
			return
		}
	}
}


Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))
L=[0 for i in range(n+1)]
for i in range(n+1):
    L[a[i]]+=1
#print(L)
D=0
for i in range(1,n+1):
    if L[i]==2:
        D=i
#print(a)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

P=[0,0,0]
One=0
#print(a)
for i in range(n+1):
    if a[i]==D:
        One+=1
    else:
        P[One]+=1
#print(P)
for i in range(1,n+2):
    print((cmb(n+1,i,mod)-cmb(P[0]+P[2],i-1,mod))%mod)


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

using namespace std;

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int mxn = 1e6 + 5;
int arr[mxn];
int n, m, k;

void solve(){
    swap(n, m);
   swap(n, k);
   cout << n << " " << m << " " << k << endl;
}

void read(){
    cin >> n >> m >> k;
//    for(int i = 0, u, v; i < n; i++){
//        cin >> arr[i];
//    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    //init();
    while(T--) read(), solve();
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t, a = map(float, input().split())
h = [float(i) for i in input().split()]

ans = -1
mini = 1<<30
for i in range(n):
    diff = abs(t - h[i] * 0.006 - a)
    if mini > diff:
        mini = diff
        ans = i + 1

print(ans)

Measured memory_bytes: 3064
s = raw_input()
d = []
cnt = 1
for i in range(len(s)-1):
    if s[i+1] == s[i]: cnt += 1
    else:
        d.append((s[i], cnt))
        cnt = 1
d.append((s[-1],cnt))
ans = 0
for i in range(len(d)-2):
    if d[i][0] == "J" and d[i+1][0] == "O" and d[i+2][0] == "I":
        if d[i+1][1] <= d[i][1] and d[i+1][1] <= d[i+2][1]:
            ans = max(ans, min(d[i][1], min(d[i+1][1], d[i+2][1])))
print ans

Measured memory_bytes: 118376
#include<bits/stdc++.h>
using namespace std;
#define lson root<<1,l,midd
#define rson root<<1|1,midd+1,r
#define pb push_back
#define ull unsigned long long
#define pii pair<int,int>
#define MP make_pair
typedef long long ll;
const ll INF=1e18;
const int inf=0x3f3f3f3f;
const int M=1e6+6;
const int mod=1e9+7;
ll a[M],f[M],F[M];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=n;i>=2;i--)
        f[i]=(f[i+1]+a[i])%mod;
    for(ll i=1;i<n;i++)
        F[i]=(F[i-1]+1ll*a[i]*f[i+1]%mod)%mod;
    cout<<F[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 8308
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

string a[10];
ll b[10];

ll hextoDec(string a) {
  ll ret = 0, b = 1;
  for(int i=a.size()-1; i>=0; --i) {
    if(isdigit(a[i])) {
      ret += (a[i] - '0') * b;
    } else {
      ret += (a[i] - 'a' + 10) * b;
    }
    b *= 16;
    //cout << i << " " << ret << endl;
  }
  return ret;
}

string dectoBin(ll a) {
  if(a == 0) return "0";
  string ret = "";
  while(a > 0) {
    if(a%2) ret = '1' + ret;
    else ret = '0' + ret;
    a /= 2;
  }
  return ret;
}

int bintoDec(string a) {
  int ret = 0;
  for(int i=a.size()-1; i>=0; --i) {
    ret *= 2;
    if(a[i] == '1') {
      ret += 1;
    }
  }

  return ret;
}

signed main(void)
{
  int s;
  cin >> s;
  REP(i, s) {
    REP(j, 9) {
      cin >> a[j];
      b[j] = hextoDec(a[j]);
      //cout << b[j] << " ";
    }
    //cout << endl;
    ll key = 0LL, c = 0;
    for(int j=0; j<32; ++j) {
      ll sum = 0;
      REP(k, 8) {
        if((b[k] >> j) & 1){
          sum++;
        }
      }
      if((sum + c) % 2 == (b[8] >> j) % 2) {
        c = (sum + c)/2;
      } else {
        key |= (1LL << j);
        c = (8-sum+c)/2;
      }
    }
    cout << hex << key << endl;
  }

  return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)



int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	int n;
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	FOR(i,0,n){
		vector<char>d;
		d.push_back(a[i]);
		d.push_back(b[i]);
		d.push_back(c[i]);
		SORT(d);
		UNIQUE(d);
		ans+=d.size()-1;
		
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, q = sc.nextInt()
    val s = sc.next().toCharArray
    
    val acs = new Array[Int](n)
    acs(0) = 0
    
    for (i <- s.indices) {
      if (i != 0) {
        if (s(i - 1) == 'A' && s(i) == 'C') {
          acs(i) = acs(i - 1) + 1
        } else {
          acs(i) = acs(i - 1)
        }
      }
    }
    
    for (i <- 0 until q) {
      val l, r = sc.nextInt()
      println(acs(r - 1) - acs(l - 1))
    }
    
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}

Measured memory_bytes: 74520
#include <bits/stdc++.h>
using namespace std;
const int maxn = 400400;
struct point {
	long long x, y, i;
};
point ROT(point a){
	return (point){a.x - a.y, a.x + a.y, a.i};
}
int main(){
	int n, pa, pb; cin >> n >> pa >> pb; pa--; pb--;
	vector<point> pts(n);
	for(int i = 0; i < n; i++) pts[i].i = i;
	for(auto & e : pts) scanf("%lld %lld", &e.x, &e.y);
	for(auto & e : pts) e = ROT(e);
	auto cost = [&](int p, int q){
		return max(abs(pts[p].x - pts[q].x), abs(pts[p].y - pts[q].y));
	};
	long long D = cost(pa, pb);
	vector<int> going_to;
       	vector<bool> added(n, false), enqueued(n, false);
	queue<int> q;
	auto enqueue = [&](int id){
		if(enqueued[id]) return;
		going_to.push_back(id);
		enqueued[id] = true;
		q.push(id);
	};
	map<long long, set<pair<long long, int> > > by_t[2];
	for(auto e : pts){
		by_t[0][e.x].insert({e.y, e.i});
		by_t[1][e.y].insert({e.x, e.i});
	}
	auto add = [&](int id){
		if(added[id]) return;
		added[id] = true;
		long long vals[2];
		vals[0] = pts[id].x;
		vals[1] = pts[id].y;
		for(int i = 0; i < 2; i++){
			for(int sig : { - 1, 1 }){
				while(true){
					long long pid = vals[i] + sig * D;
					auto it = by_t[i][pid].lower_bound(make_pair(vals[i^1] - D, -1));
					if(it == by_t[i][pid].end() || cost(id, it->second) > D) break;
					enqueue(it->second);
					by_t[i][pid].erase(it);
				}
			}
		}
	};
	enqueue(pa);
	enqueue(pb);
	while(!q.empty()){
		int u = q.front(); q.pop();
		add(u);
	}
	map<long long, vector<long long> > by_x, by_y;
	for(int to: going_to){
		by_x[pts[to].x].push_back(pts[to].y);
		by_y[pts[to].y].push_back(pts[to].x);
	}
	for(auto & e : by_x) sort(e.second.begin(), e.second.end());
	for(auto & e : by_y) sort(e.second.begin(), e.second.end());
	auto count_on = [&](int is_x, long long val, long long l, long long r){
		if(is_x) return lower_bound(by_x[val].begin(), by_x[val].end(), r + 1) - lower_bound(by_x[val].begin(), by_x[val].end(), l);
		return lower_bound(by_y[val].begin(), by_y[val].end(), r + 1) - lower_bound(by_y[val].begin(), by_y[val].end(), l);
	};
	long long ans = 0;
	for(int to : going_to){
		ans += count_on(1, pts[to].x - D, pts[to].y - D, pts[to].y + D - 1);
		ans += count_on(0, pts[to].y + D, pts[to].x - D, pts[to].x + D - 1);
		ans += count_on(1, pts[to].x + D, pts[to].y - D + 1, pts[to].y + D);
		ans += count_on(0, pts[to].y - D, pts[to].x - D + 1, pts[to].x + D);
	}
	cout << ans/2 << endl;
	return 0;
}


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

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

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

	for(int n; cin >> n && n;) {
		vector<unsigned> p(n), q(n - 1);
		for(auto &e : p) cin >> e;
		for(auto &e : q) cin >> e;

		sort(q.rbegin(), q.rend());

		unsigned sum = accumulate(p.begin(), p.end(), 0);
		unsigned ans = sum * n;

		for(int i = 0; i < n - 1; ++i) {
			sum += q[i];
			chmax(ans, sum * (n - i - 1));
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

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

int main() {
	string s;
	cin >> s;
	bool a[26] = { false };
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < 26; j++) {
			if (s[i] == 'a' + j) {
				if (!a[j])a[j] = true;
				else {
					cout << "no" << endl;
					return 0;
				}
			}
		}
	}
	cout << "yes" << endl;
	return 0;
}

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

const int letter_MAX = 1201;
int co[26] = {};
int letter[letter_MAX];


int main(){
	for (int j = 0; j < letter_MAX;j++){
		letter[j]=getchar();
		if (letter[j] == EOF)break;
		letter[j] = tolower(letter[j]);
		for (int i = 0; i < 26; i++){
			if (i == letter[j] - 'a')co[i]++;
		}
	}
	for (int i = 0; i < 26; i++){
		char a = i + 'a';
		cout << a << " : " << co[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <stdio.h>
#include <iterator>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <unordered_map>
#include <iomanip>

using namespace std;

void solve() {
    string s, res; cin >> s;
    if(s == "A") res = "T";
    else if (s == "C") res = "G";
    else if (s == "G") res = "C";
    else res = "A";
    cout << res << endl;
}

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

Measured memory_bytes: 256
N = int(input())
xy = [[] for i in range(N)]
for i in range(N):
    A = int(input())
    for j in range(A):
        x, y = map(int, input().split())
        xy[i].append([x, y])

ans = 0

for i in range(2**N):
    b = format(i, "0" + str(N) + "b")
    t = 0
    f = 0
    for j in range(N):
        if b[j] == "1":
            t += 1
            for k in xy[j]:
                if str(k[1]) != b[k[0]-1]:
                    f = 1
                    break
    if f == 0:
        ans = max(ans, t)
        #print(b)

print(ans)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int A[3]={},c=0;
  rep(i,3){
    cin >> A[i];
    if(A[i]%2==0) c++;
  }
  sort(A,A+3);
  int maxi=-1,mini=55,tmp=0,ans=0;
  if(c==1){
    rep(i,3){
      if(A[i]%2==0){
        rep(j,3){
          if(j==i);
          else{
            chmax(maxi,A[j]);
            tmp+=A[j];
          }
        }
        if(maxi>A[i]) ans=(maxi+1-A[i])/2+1+(2*(maxi)-tmp)/2;
        else ans=1+(2*A[i]-(tmp+2))/2;
      }
    }
  }
  else if(c==2){
    rep(i,3){
      if(A[i]%2==1){
        rep(j,3){
          if(j==i);
          else{
            chmax(maxi,A[j]);
            tmp+=A[j];
          }
        }
        if(maxi>A[i]) ans=(maxi+1-A[i])/2+1+(2*(maxi)-tmp)/2;
        else ans=1+(2*A[i]-(tmp+2))/2;
      }
    }
  }
  else{
    int a=A[2]-A[0],b=A[2]-A[1];
    ans=a/2+b/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
SS ss;
#define debug ss
#endif

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int sq(int n){return n*n;}

int f(pint aa,pint bb){
	int a[4];
	a[0]=aa.first;
	a[1]=aa.second;
	a[2]=bb.first;
	a[3]=bb.second;
	sort(a,a+4);
	return sq(a[0]-a[1])+sq(a[1]-a[2])+sq(a[2]-a[3]);
}

int main() {
	int a,b;
	IL{
		cin>>a>>b;
		if(a==0&&b==0)break;
		vpint aa,bb;
		for(int i=1;i*i<=a;++i)if(a%i==0)aa.PB(MP(i,a/i));
		for(int i=1;i*i<=b;++i)if(b%i==0)bb.PB(MP(i,b/i));
		int mn=INF;
		rep(i,sz(aa))rep(j,sz(bb))chmin(mn,f(aa[i],bb[j]));
		cout<<mn<<endl;
	}
	return 0;
}

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

using namespace std;

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

int main(){
    int n, l;
    cin >> n >> l;
    int minus;
    if(l+n > 0 && l <= 0)minus = 0;
    else if(l > 0)minus = -l;
    else minus = -(l+n-1);
    cout << l*n+(n-1)*n/2+minus << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

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

int main(){
    string n;
    cin >> n;
    int y(0);
    int x = atoi(n.c_str());
    rep(i,n.size()){
        char c = n[i];
        y += c-'0';
    }

    if(x%y==0){
        puts("Yes");
    }else{
        puts("No");
    }



    return 0;
}

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

int main()
{
	int r, g, b;

	cin >> r >> g >> b;

	int n = r * 100 + g * 10 + b;

	if( n % 4 == 0 ) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
task = []
for i in range(1,M + 1):
    task.append("A_" + str(i))

task = map(int, input().split())
task_total = sum(task)

if task_total <= N:
    print(N - task_total)

else:
    print(-1)
    

Measured memory_bytes: 10216
l=[]
n=int(input())
for _ in range(n):
  a=list(map(int,input().split()))
  l.append(a)

flag=0
for i in range(1,n-1):
  if l[i-1][0]==l[i-1][1] and  l[i][0]==l[i][1] and  l[i+1][0]==l[i+1][1]:
    flag=1
    break

if flag==1:
  print("Yes")
else:
  print("No")

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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N;i++){
        cin >> a[i];
    }
    cout << abs(*max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end()));
}

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


int max2(int a, int b){
    if (a>b) return a;
    else return b;
}

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

  int n = 0;
  int temp = 0;
  if(N!=0){
    int before;
    cin >> before;
    for(int i=0; i<N-1; i++){
      int now;
      cin >> now;
      if(before >= now) {before = now; temp++;}
      else {before = now; n=max2(temp,n); temp =0;}
    }
    n=max2(temp,n);
  }
  cout << n << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <string.h>
#include <cassert>
 
#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif
 
#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (count); i++)
 
using namespace std;
typedef long long ll;
const int MODULO = 1000000007;
 
typedef pair<int,int> Pii;
// begin

int h,w;
char s[1000][1001];
int t[1001][1001];
 
int solve(){
    memset(t,0,sizeof(t));
    for(int i =0 ; i < h; i++){
		int cnt = 0;
		cin>>s[i];
		for (int j = w - 1; j >= 0 ; j--){
			if(s[i][j] == '.'){
				t[i][j] = ++cnt;
			}else{
				t[i][j] = cnt = 0;
			}
		}
    }
 
    int ans = 0;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
			int w = INT_MAX;
			for(int k = 0; i + k < h && s[i + k][j] == '.'; k++){
				w = min(w,t[i+k][j]);
				ans = max(ans,(k + 1) * w);
			}
        }
    }
    return ans;
}
 
int main(){
    while(cin>>h>>w,(h||w)){
        cout << solve() << endl;
    }
    return 0;
}

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

int main() {
int A,B;
  int result = 0;
  int a = 0;
  cin >> A >> B;
  for(result = 1;result <= 10000;result++){
   if(int(result * 0.08) == A&&int(result * 0.1) == B){cout<<result<<endl;a = 1;break;}
  }
 if(a==0)cout << -1 << endl;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int Q = scan.nextInt();
		int a, b, p, x;

		HashMap<Integer, Set<Integer>> map = new HashMap<>();
		for (int i = 0; i < N - 1; i++) {
			a = scan.nextInt();
			b = scan.nextInt();
			if (!map.containsKey(a)) {
				Set set = new HashSet<>();
				map.put(a, set);
			}
			map.get(a).add(b);

			if (!map.containsKey(b)) {
				Set set = new HashSet<>();
				map.put(b, set);
			}
			map.get(b).add(a);
		}
		int[] score = new int[N];
		for (int i = 0; i < Q; i++) {
			p = scan.nextInt();
			x = scan.nextInt();
			score[p - 1] += x;
		}

//		ArrayDeque<Integer> que = new ArrayDeque();
		Queue<Integer> que = new LinkedList<>();
		que.offer(1);
		boolean[] visited = new boolean[N];

		while (!que.isEmpty()) {
			int tgt = que.poll();
			Set<Integer> tgtSet = map.get(tgt);
			visited[tgt - 1] = true;
			for (Integer next : tgtSet) {
				if (!visited[next - 1]) {
					score[next - 1] += score[tgt - 1];
					que.offer(next);
				}
			}
		}

		// 結果の出力
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < N; i++) {
			sb.append(score[i]).append(" ");
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 288056
'use strict'

const main = (INPUT) => {
  const S = INPUT.split('\n')[0]
  let ans = 0
  for (let i = 0; i < S.length / 2; i++) {
    if (S[i] != S[S.length - 1 - i]) {
      ans++
    }
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 29528
import java.io.*;
class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        String str = br.readLine();
        String strArr[] = str.split(" ");
 
        int w, h, x, y, r;
 
        w = Integer.parseInt(strArr[0]);
        h = Integer.parseInt(strArr[1]);
        x = Integer.parseInt(strArr[2]);
        y = Integer.parseInt(strArr[3]);
        r = Integer.parseInt(strArr[4]);
 
        if(x+r<=w && x-r>=0 && y+r<=h && y-r>=0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 24328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.LinkedList;


public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.calculationTimeCard();
		return;
	}
	
	//タイムカードの計算処理
	private void calculationTimeCard() {
		
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); //標準入力
		
		try {
			
			Calendar attendanceTimeA = Calendar.getInstance(); //Aの出社時刻
			Calendar leavingTimeA = Calendar.getInstance(); //Aの退社時刻
			Calendar attendanceTimeB = Calendar.getInstance(); //Bの出社時刻
			Calendar leavingTimeB = Calendar.getInstance(); //Bの退社時刻
			Calendar attendanceTimeC = Calendar.getInstance(); //Bの出社時刻
			Calendar leavingTimeC = Calendar.getInstance(); //Bの退社時刻
			
			//カレンダーをリストにする
			LinkedList<Calendar> attendanceTimeCalendarList = new LinkedList<Calendar>(); //出社時間のリスト
			LinkedList<Calendar> leavingTimeCalendarList = new LinkedList<Calendar>(); //退社時刻のリスト
			attendanceTimeCalendarList.add(attendanceTimeA);
			leavingTimeCalendarList.add(leavingTimeA);
			attendanceTimeCalendarList.add(attendanceTimeB);
			leavingTimeCalendarList.add(leavingTimeB);
			attendanceTimeCalendarList.add(attendanceTimeC);
			leavingTimeCalendarList.add(leavingTimeC);
			
			//カレンダーに出退勤の時刻を入力する
			for (int i = 0; i < 3; i++) {
				
				String inputStr = bufferedReader.readLine();
				String[] inputStrs = inputStr.split(" ");
				int attendanceTimeHour = Integer.parseInt(inputStrs[0]);
				int attendanceTimeMinute = Integer.parseInt(inputStrs[1]);
				int attendanceTimeSecond = Integer.parseInt(inputStrs[2]);
				int leavingTimeHour = Integer.parseInt(inputStrs[3]);
				int leavingTimeMinute = Integer.parseInt(inputStrs[4]);
				int leavingTimeSecond = Integer.parseInt(inputStrs[5]);
				
				attendanceTimeCalendarList.get(i).set(2014, 4, 1, attendanceTimeHour, attendanceTimeMinute, attendanceTimeSecond);
				leavingTimeCalendarList.get(i).set(2014, 4, 1, leavingTimeHour, leavingTimeMinute, leavingTimeSecond);
			}
			
			//勤務時間を計算する
			LinkedList<Calendar> workingHoursList = new LinkedList<Calendar>(); //勤務時間のリスト
			for (int i = 0; i < 3; i++) {
				
				workingHoursList.add(Calendar.getInstance());
				
				//退社時刻と出社時刻の差分を求める
				long workingHour = leavingTimeCalendarList.get(i).getTimeInMillis() - attendanceTimeCalendarList.get(i).getTimeInMillis() - workingHoursList.get(i).getTimeZone().getRawOffset();
				workingHoursList.get(i).setTimeInMillis(workingHour);
				
			}
			
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("H m s");
			for (int i = 0; i < 3; i++) {
				String workingHourStr = simpleDateFormat.format(workingHoursList.get(i).getTime());
				System.out.println(workingHourStr);
			}
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
	}
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    const ll MOD = 1e9 + 7;
    ll ans = pow_mod(10, n, MOD);
    ans += MOD - pow_mod(9, n, MOD);
    ans += MOD - pow_mod(9, n, MOD);
    ans += pow_mod(8, n, MOD);
    cout << ans%MOD << endl;

    return 0;
}

Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

//func nextUint64() uint64 {
//	sc.Scan()
//	i, e := strconv.ParseUint(sc.Text(), 10, 64)
//	if e != nil {
//		panic(e)
//	}
//	return i
//}

func main() {
	n := nextInt()
	x := nextInt()
	t := nextInt()

	c := n / x
	r := n % x

	if r == 0 {
		fmt.Println(c * t)
	} else {
		fmt.Println((c + 1) * t)
	}
}


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

using namespace std;

typedef long long int lo;
typedef pair<int,int> PII;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR for(int i=1;i<=  n;i++)
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mid (start+end)/2

const lo mod = 1000000007;
const lo li = 100005;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;

int n,m,cev,a[li],vis[li];

int main(){
	scanf("%d",&n);
	FOR{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<=vis[i]) continue;
		for(int k=1;k<=a[i];k++){
			if(a[i]<=vis[i]) break;
			for(int j=i;j<=n;j++){
				//~ cout<<
				//~ if(j==2)
					//~ cout<<vis[j]<<" "<<a[j]<<endl;
				if(vis[j]>=a[j]){
					//~ cout<<j<<endl;
					for(int kk=i;kk<=j-1;kk++){
						//~ if(kk==2) cout<<j<<endl;
						vis[kk]++;
						//~ cev++;
					}
					cev++;
					break;
				}
				else if(j==n){
					for(int kk=i;kk<=j;kk++){
						//~ if(kk==2) cout<<j<<endl;
						vis[kk]++;
						//~ cev++;
					}
					cev++;
					break;
				}
			}
		}
	}
	//~ FOR{
		//~ cout<<vis[i]<<endl;
	//~ }
	printf("%d\n",cev);
	return 0;
}


Measured memory_bytes: 256
n, m = list(map(int, input().split()))

import numpy as np
dists = np.ones((n + 1, n + 1)) * (10 ** 6)
edges = []
for _ in range(m):
    a, b, c = list(map(int, input().split()))
    dists[a, b] = dists[b, a] = c
    edges.append((a, b, c))
for i in range(1, n + 1):
    dists[i, i] = 0
for i in range(1, 1 + n):
    dists = np.minimum(dists, dists[i: i + 1] + dists[:, i: i + 1])
cnt = 0
for a, b, c in edges:
    if dists[a, b] < c:
        cnt += 1

print(cnt)


Measured memory_bytes: 22304
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

s = input()
ans = 0
for i in range(len(s)//2):
    if s[i] != s[len(s) - i - 1]:
        ans += 1
print(ans)

Measured memory_bytes: 12484
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int[][] dp;
	static String name;
	static int N, M;
	static int[] C, V, D, L;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	static boolean read(){
		if(!sc.hasNext())
			return false;
		N = sc.nextInt(); M = sc.nextInt();
		dp = new int[N+1][M+1];
		C = new int[N]; V = new int[N]; D = new int[N]; L = new int[N];
		for(int i = 0; i < N; i++){
			String str;
			do{
				str = sc.next();
			}while(!Character.isDigit(str.charAt(0)));
			C[i] = Integer.parseInt(str);
			V[i] = sc.nextInt(); D[i] = sc.nextInt(); L[i] = sc.nextInt();
			}

		return true;
	}
	static void solve(){
		int ans = Math.max(selectVocal(), selectDance());
		ans = Math.max(ans, selectLooks());
		System.out.println(ans);
	}
	static int selectVocal(){
		for(int i = 0; i < N; i++){
			for(int j = 0; j <= M; j++){
				if(j < C[i]){
					dp[i + 1][j] = dp[i][j];
				}else{
					dp[i + 1][j] = Math.max(dp[i][j], dp[i + 1][j - C[i]] + V[i]);
				}
			}
		}
		return dp[N][M];
	}
	static int selectDance(){
		for(int i = 0; i < N; i++){
			for(int j = 0; j <= M; j++){
				if(j < C[i]){
					dp[i + 1][j] = dp[i][j];
				}else{
					dp[i + 1][j] = Math.max(dp[i][j], dp[i + 1][j - C[i]] + D[i]);
				}
			}
		}
		return dp[N][M];
	}
	static int selectLooks(){
		for(int i = 0; i < N; i++){
			for(int j = 0; j <= M; j++){
				if(j < C[i]){
					dp[i + 1][j] = dp[i][j];
				}else{
					dp[i + 1][j] = Math.max(dp[i][j], dp[i + 1][j - C[i]] + L[i]);
				}
			}
		}
		return dp[N][M];
	}

}

Measured memory_bytes: 16000
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string w[n];
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }   
    char siri;
    bool flag = true;
    for (int i = 0; i < n - 1; i++) {
        int size = w[i].size();
        char siri = w[i].at(size - 1); 
        char atama = w[i + 1].at(0);
        if (
            siri
            != atama) {
            flag = false;
        }
    }   
    if (flag) {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j
                                < n;
                 j++) {
                if (w[i] == w[j]) {
                    flag = false;
                    break;
                }
            }
        }
    }   
    if (flag) {
        cout << "Yes";
    } else {
        cout << "No";
    }   
}


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

int k,s,x,y,z,ans;
int main()
{
	cin>>k>>s;
	for(x=0;x<=k;x++)
	   for(y=0;y<=k;y++)
	   {
	   	z=s-x-y;
	   	if(z<=k&&z>=0)ans++;
	   }
	cout<<ans<<endl;
}

Measured memory_bytes: 256
D,G=map(int,input().split())
 
pc=[list(map(int,input().split())) for i in range(D)]
 
ans=float('inf')
 
for i in range(1<<D):
    s=0
    c=0
    for k in range(D):
        if 1&i>>k:
            s+=(k+1)*100*pc[k][0]+pc[k][1]
            c+=pc[k][0]
 
    if s>=G:
        ans=min(ans,c)
 
    if s<G:
        for k in reversed(range(D)):
            if not(1&i>>k):
                ac=-(-(G-s)//((k+1)*100))
                if  pc[k][0]>ac:
                    ans=min(ans,c+ac)
                    break
print(ans)

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll n, d, a;
	cin >> n >> d >> a;
	vector <pair <ll, ll>> m(n+2);
	vector <ll> dp(n+2);
	for (int i=1; i<=n; i++) {
		cin >> m[i].first >> m[i].second;
	}
	ll ans = 0;
	m[0] = {-100, -1000};
	m[n+1] = {1e18, 1e17};
	sort(m.begin(), m.end());
	for (int i=1; i<=n; i++) {
		dp[i] += dp[i-1];
		if (dp[i] >= m[i].second) continue;
		int x = i;
		for (int j=(1<<20); j>=1; j=(j>>1)) {
			if (x+j > n) continue;
			if (m[x+j].first <= m[i].first+d+d) {
				x += j;
			}
		}
		ll val = (m[i].second-dp[i] + a-1)/a;
		ans += val;
		val *= a;
		dp[i] += val;
		if (x <= n) dp[x+1] -= val;
	}
	cout << ans;
	return 0;
}


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

typedef pair<int,int> pii;
typedef vector<int> vec;
typedef unordered_map<int,int> hash;
#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,v) memset(a,v,sizeof(a))
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast
#define MOD 1000000007


int main()
{
	JJ;
	int n; cin>>n;
	int arr[10050]={0};
		// FOR(a,1,n+1){
		int ans=0;
		FOR(i,1,105){
			FOR(j,1,105){
				FOR(k,1,105){
					int num=i*i + j*j + k*k +(i*j+j*k+k*i);
					if(num<10050)
					// {
						arr[num]++;
						// dp[num]++;
						// break;
					// }
 
				}
			}
		}
		// cout<<ans<<endl;
		FOR(i,1,n+1){
			cout<<arr[i]<<endl;
		}
	// }
	


	return 0;
}


Measured memory_bytes: 3604
#include <cstdio>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
int arr[3][100005], mid[100005], cnt[2];
bool vis[100005];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < n; j++)
			scanf("%d", arr[i] + j);
	}
	try
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				if (my_abs(arr[j][i] - arr[j + 1][i]) != 1)
					throw false;
			}
			mid[i] = (arr[1][i] - 2) / 3;
			if ((mid[i] & 1) != (i & 1))
				throw false;
			cnt[i & 1] ^= arr[0][i] > arr[2][i];
		}
		for (int i = 0; i < n; i++)
		{
			if (vis[i])
				continue;
			cnt[i & 1 ^ 1] ^= 1;
			int x = i;
			while (!vis[x])
			{
				vis[x] = true;
				cnt[i & 1 ^ 1] ^= 1;
				x = mid[x];
			}
		}
		if (cnt[0] || cnt[1])
			throw false;
		puts("Yes");
	}
	catch (...)
	{
		puts("No");
	}
	return 0;
}


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

bool eq(vector<int> a,vector<int> b){
  for(int i=0;i<a.size();i++){
    if(!(a.at(i)==b.at(i)))return false;
  }
  return true;
}

int main(){
  int n;cin>>n;
  vector<int> p(n);
  for(int i=0;i<n;i++){int a;cin>>a;p.at(i)=a;}
  vector<int> q(n);
  for(int i=0;i<n;i++){int a;cin>>a;q.at(i)=a;}
  vector<int> s(n);
  for(int i=0;i<n;i++)s.at(i)=i+1;
  
  int a=0,b=0,cnt=1;
  do{
    if(eq(s,p))a=cnt;
    if(eq(s,q))b=cnt;
    cnt++;
  }while(next_permutation(s.begin(),s.end()));
  
  cout<<abs(a-b)<<endl;
}

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


int main () {
    ll V, E ;
    cin >> V >> E ;
    vector<vector<P>> cost(V) ;
    rep(i, E){
        int s, t, w ;
        cin >> s >> t >> w ;
        P p = P(t, w) ;
        cost[s].push_back(p) ;
        P k = P(s, w) ;
        cost[t].push_back(k) ;
    }
    vector<bool> used (V, false) ;
    vector<ll> d (V, INF) ;
    d[0] = 0;
    ll res = 0 ;
    while(1 == 1){
        int v = -1 ;
        rep(i, V){
            if(!used[i] && (v == -1 || d[i] < d[v])){
                v = i ;
            }
        }
        if(v == -1){
            break ;
        }
        used[v] = true ;
        res += d[v] ;
     
            rep(j, cost[v].size()){
                ll k = cost[v][j].second ;
                ll m = cost[v][j].first ;
                d[m] = min(d[m],  k) ;
            }
        
    }
    cout << res << endl ;

} 



Measured memory_bytes: 5992
import sys

def main():
  input = sys.stdin.readline().rstrip

  a, b = map(int, input().split())

  if a < b:
    print('a < b')
  elif a > b:
    print('a > b')
  elif a == b:
    print('a == b')


if __name__ == '__main__':
  main()



Measured memory_bytes: 5604