akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  if(a>0){
    cout << "Positive" << endl;
  }else if (b>=0){
    cout << "Zero" << endl;
  }else{
    if ((b-a)%2==0){
      cout << "Negative" << endl;
    }else{
      cout << "Positive" << endl;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
  long long n,m,i,j,ans=1;
  scanf("%lld %lld",&n,&m);
  if(n==1){
    printf("%lld\n",m);
    return 0;
  }
  for(i=2;i*i<=m;i++){
    for(j=0;m&&m%i==0;j++)m/=i;
    //printf("%lld\n",j);
    ans*=pow(i,j/n);
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    int N;
    string A, B, C;
    cin >> N >> A >> B >> C;
    int cnt=0;
    rep(i,N){
        if(A.at(i) != B.at(i) && B.at(i) != C.at(i) && C.at(i) != A.at(i)){
            cnt += 2;
            //cout << "+2" << endl; 
        }
        else if(!(A.at(i) == B.at(i) && B.at(i) == C.at(i))){
            cnt++;
            //cout << "+1" << endl;
        }
        //cout << cnt << endl;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
 
 
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
int tc;
const int N=3e5+5,M=3e5+5,MOD=1e9+7,OO=1e9;

int n,k;
std::vector<int> g[N];
ll dfs(int u,int p){

	ll ret = 1;
	int canuse = k-1;	
	if(u!=1)canuse--;
	for(auto v : g[u]){
		if(v==p)continue;
		if(canuse<=0)return 0;
		ret*=(canuse*dfs(v,u)%MOD);
		canuse--;
		ret%=MOD;
	}
	return ret;
}
int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	//file();

 	scanf("%d %d",&n,&k);

 	for(int i=1,a,b;i<n;i++)scanf("%d %d",&a,&b),g[a].pb(b),g[b].pb(a);

 	printf("%lld\n",k*dfs(1,0)%MOD);
}



Measured memory_bytes: 16256
import math
import sys

def judgement(num):
	dest = int(math.sqrt(num))
	for i in range(2,dest):
		if num % i == 0:
			return False
	return True
X = int(input())

while True:
	if judgement(X) == False:
		X += 1
	else:
		print(X)
		sys.exit()



Measured memory_bytes: 2940
#include<iostream>
#include<cmath>
#include<sstream>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
ll N[9];

string lltos(ll x)
{
  stringstream ss;
  ss << hex << x;
  return ss.str();
}

void rec(int p,string K,ll carry)
{
  if(p >= 8)
    {
      reverse(K.begin(),K.end());
    
      int cnt = 0;  
      rep(i,K.size())
	{
	  cnt++;
	  if(K[i] == '0')continue;
	  
	  K = K.substr(i,K.size()-i);
	  break;
	}
      if(cnt == K.size())K = "0";
	
      cout<< K << endl;    
      return;
    }
  ll cret[9];
  ll x = 0xf*pow(16LL,p);
  ll v = pow(16LL,p);
  rep(i,9)cret[i] = (x&N[i])/v;
    
  rep(k,16)
    {
      ll total = carry;
      rep(i,8)
	{
	  total += (cret[i]^k);
	}
      if(total%16 == (cret[8]^k))
	{
	  rec(p+1,K+lltos(k),total/16);
	}
    }
}

int main()
{ 
  int T;
  cin >> T;
  while(T-- > 0)
    {
      rep(i,9)cin >> hex >> N[i];
      rec(0,"",0);
    }
      
  return 0;
}

Measured memory_bytes: 1272
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),t=Number(r[0]),n=r[1],o=0,u=0;u<t-1;u++){for(var f={},i=0;i<=u;i++)f[n[i]]||(f[n[i]]=1);for(var l=u+1;l<t;l++)f[n[l]]&&(f[n[l]]=2);var a=0;for(var c in f)2==f[c]&&(a+=1);o=Math.max(o,a)}console.log(o)}},function(e,r){e.exports=require("fs")}]);

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

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m))
#define all(a) (a).begin(), (a).end()
#define sz(a) int((a).size())
#define pb(a) push_back(a)
#define mp(x, y) make_pair((x), (y))
#define x first
#define y second

using namespace std;

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

template<typename A, typename B> inline ostream& operator<< (ostream& out, const pair<A, B>& p) { return out << "(" << p.x << ", " << p.y << ")"; }
template<typename T> inline ostream& operator<< (ostream& out, const vector<T>& a) { out << "["; forn(i, sz(a)) { if (i) out << ','; out << ' ' << a[i]; } return out << " ]"; } 
template<typename T> inline ostream& operator<< (ostream& out, const set<T>& a) { return out << vector<T>(all(a)); }
template<typename X, typename Y> inline ostream& operator<< (ostream& out, const map<X, Y>& a) { return out << vector<pair<X, Y>>(all(a)); }
template<typename T> inline ostream& operator<< (ostream& out, pair<T*, int> a) { return out << vector<T>(a.x, a.x + a.y); }

inline ld gett() { return ld(clock()) / CLOCKS_PER_SEC; }

const int INF = int(1e9);
const li INF64 = li(1e18);
const ld EPS = 1e-9, PI = 3.1415926535897932384626433832795;

#ifdef SU1
#define LOG
#endif

const int N = 300 + 5;

int w, h;
char aa[N][N], a[N][N];

bool read() {
	if (!(cin >> h >> w))
		return false;
	forn(i, h)
		assert(cin >> aa[i]);
	forn(i, w)
		forn(j, h)
			a[i][j] = aa[j][i];
	return true;
}

int col;
int dp[N][N];
int val[N][N];

int calcdp(int i, int j) {
	if (dp[i][j] != -1)
		return dp[i][j];

	int &res = dp[i][j];
	if (i == 0 || j == 0)
		return res = 0;	
	return res = min(calcdp(i - 1, j), calcdp(i, j - 1)) + val[i][j];
}

void solve() {
	int res = 0;
	forn(i, w - 1) {
		memset(dp, -1, sizeof(dp));
		memset(val, 0, sizeof(val));
		col = i;		
		fore(i, 1, h + 1)
			fore(j, 1, h + 1) {
				val[i][j] = val[i - 1][j - 1];
				if (a[col][i - 1] == a[col + 1][j - 1])
					val[i][j]++;
			}
		

		res += calcdp(h, h);
	}
	cout << res << endl;
}

int main() {
#ifdef SU1
    assert(freopen("input.txt", "rt", stdin));
    //assert(freopen("output.txt", "wt", stdout));
#endif
    
    cout << setprecision(10) << fixed;
    cerr << setprecision(5) << fixed;

    while (read()) {
		ld stime = gett();
		solve();
		cerr << "Time: " << gett() - stime << endl;
		//break;
	}
	
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>

int main() {
  int a,b,k;
  scanf("%d %d %d", &k, &a, &b);
  for(int i=a; i<=b; i++) {
    if(i%k == 0) {
      printf("OK\n");
      return 0;
    }
  }
  printf("NG\n");
  return 0;
}

Measured memory_bytes: 1560
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<Int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    cout << abs(a[0] - a[n - 1]) << endl;

    return 0;
}


Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#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;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

void a(); void b(); void c(); void d(); void e(); void f();

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

	// a();
	// b();
	// c();
	d();
	// e();
	// f();
	return 0;
}


void a(){
	string s, t;
	cin >> s >> t;
	t.erase(t.begin() + s.size());
	if(s == t)puts("Yes");
	else puts("No");
}

void b(){
	lint a, b, c, k;
	cin >> a >> b >> c >> k;
	lint ans = min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	ans -= min(c, k);
	cout << ans;
}

void c(){
	int n, m, x;
	cin >> n >> m >> x;
	vector<lint> a[150], c(150);
	forn(i, n){
		cin >> c[i];
		a[i].resize(150);
		forn(j, m)cin >> a[i][j];
	}
	lint ans = LLONG_MAX;
	for(int i = 0; i < (1 << n); i++){
		vector<lint> sel, A(150, 0);
		for(int j = 0; j < n; j++){
			if(i & (1 << j))sel.pb(j);
		}
		lint cs = 0;
		for(auto j:sel){
			cs += c[j];
			forn(k, a[j].size())A[k] += a[j][k];
		}
		int ct = 0;
		forn(j, m)if(A[j] >= x)ct++;
		if(ct == m){
			ans = min(ans, cs);
		}
	}
	if(ans == LLONG_MAX)cout << -1;
	else cout << ans;
}

void d(){
	int n;
	lint k;
	cin >> n >> k;
	vi a(n + 50);
	map<int, int> m;
	bool used[1000005];
	memset(used, 0, sizeof used);
	for1(i, n){
		cin >> a[i];
	}
	vi seq;seq.pb(1);
	int st = a[1], cy;
	while(true){
		if(used[st]){
			cy = find(all(seq), st) - seq.begin();
			break;
		}
		seq.pb(st);
		used[st] = true;
		st = a[st];
		// deb(st);
	}
	if(k >= (int)seq.size()){
		k -= seq.size();
		k %= (seq.size() - cy);
		cout << seq[cy + k];
	}else {
		cout << seq[k] << '\n';
	}

}

void e(){

}

void f(){

}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

struct Sieve {
  vector<int> table;
  Sieve(int n=2): table(n+1) {
    table[0] = table[1] = -1;
    for (int i=2; i<=n; i++) {
      if (table[i]) continue;
      for (int j=i+i; j<=n; j+=i) {
        table[j] = i;
      }
    }
  }

  void print() {
    for (auto e: table) {
      cout << e << " ";
    }
    cout << endl;
  }

  map<int, int> primes(int i) {
    map<int, int> m;
    if (i < 2) return m;
    // (素数, カウント)
    // ex. primes(12) == {(2, 2), (3, 2)}
    while(table[i]) {
      m[table[i]]++;
      i /= table[i];
    }
    m[i]++;
    return m;
  }
};

ll power(ll base, ll exponent, ll module) {
  if (!exponent) return 1;
  if (exponent%2 == 1) {
    return base * power(base, exponent-1, module) % module;
  } else {
    ll root_ans = power(base, exponent/2, module);
    return root_ans * root_ans % module;
  }
}


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

  int max_ = 0;
  vector<int> as;
  REP(i, n) {
    int a;
    cin >> a;
    as.push_back(a);
    if (max_ < a) max_ = a;
  }

  Sieve sieve(max_);

  map<int, int> lcm_map;
  for (auto a: as) {
    map<int,int> ps = sieve.primes(a);
    for (auto p: ps) {
      if (lcm_map[p.first] < p.second) lcm_map[p.first] = p.second;
    }
  }

  ll c = 1;
  for (auto e: lcm_map) {
    c = (c * power(e.first, e.second, mod)) % mod;
  }

  ll ans = 0;
  for (auto a: as) {
    ll b = (c * power((ll)a, mod-2, mod)) % mod;
    ans = (ans + b) % mod;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  int n, m;
  string s;
  cin >> n >> m >> s;
  vector<int> p(n+1), q(n+1);
  p[0] = 0; q[0] = 0; q[1] = 0;
  rep(i, n-1){
    if(s[i] == 'A' && s[i+1] == 'C') p[i+1] = p[i]+1;
    else p[i+1] = p[i];
  }
  p[n] = p[n-1];
  rep(i, n-1){
    if(s[i] == 'A' && s[i+1] == 'C') q[i+2] = q[i+1]+1;
    else q[i+2] = q[i+1];
  }
  rep(i, m){
    int l, r;
    cin >> l >> r;
    cout << q[r] - p[l-1] << endl;
  }
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair
#define P pair<int, int>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;

int main() {
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;

	int sum = 0;

	for (int i = 0; i < n; i++) {
		int count = 0;
		if (a[i] == b[i]) {
			count++;
		}
		if (b[i] == c[i]) {
			count++;
		}
		if (c[i] == a[i]) {
			count++;
		}

		if (count == 1) {
			sum += 1;
		}
		else if(count == 0) {
			sum += 2;
		}
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
module DoublyLinkedList = struct

  type t = {
    mutable data : int;
    mutable next : t;
    mutable prev : t;
  }

  let make () =
    let rec head = { data = 0; next = head; prev = head } in
    head

  let insert data head =
    let x = { data = data; next = head.next; prev = head } in
    head.next.prev <- x;
    head.next <- x

  let delete x =
    x.next.prev <- x.prev;
    x.prev.next <- x.next

  let delete_first head = delete head.next

  let delete_last head = delete head.prev

  let delete_node data head =
    let rec doit ite =
      if ite == head then None
      else if ite.data = data then Some ite
      else doit ite.next in
    match doit head.next with
    | None -> ()
    | Some ite -> delete ite

  let print_elements head =
    print_int head.next.data;
    let rec doit ite =
      if ite == head then ()
      else begin
        print_string " ";
        print_int ite.data;
        doit ite.next
      end in
    doit head.next.next

end

module L = DoublyLinkedList

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let head = L.make () in
  for _ = 0 to n - 1 do
    match split_on_char ' ' (read_line ()) with
    | ["insert"; n] -> L.insert (int_of_string n) head
    | ["delete"; n] -> L.delete_node (int_of_string n) head
    | ["deleteFirst"] -> L.delete_first head
    | _ -> L.delete_last head
  done;
  L.print_elements head;
  print_newline ()

Measured memory_bytes: 41040
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

void solve() {
  int H, W; cin >> H >> W;
  vector<string> G(H+2, "..");
  rep(i,W) G[0].push_back('.');
  rep(i,W) G[H+1].push_back('.'); 
  string s;
  rep(i,H) {
    cin >> s;
    G[i+1].insert(1, s);
  }

  for (int i=1; i<=H; ++i) {
    for (int j=1; j<=W; ++j) {
      if (G[i][j] == '.') continue;
      if (G[i-1][j] == '#') continue;
      if (G[i+1][j] == '#') continue;
      if (G[i][j-1] == '#') continue;
      if (G[i][j+1] == '#') continue;
      cout << "No\n";
      return;
    }
  }

  cout << "Yes\n";
  return;
}

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


Measured memory_bytes: 256
$a=$<.map{|s|s.chop.reverse.chars};
def f(n)
	if $a[n].size==0
		puts (n+65).chr;
		exit 0;
	end
	i=$a[n][-1]=='a' ? 0 : $a[n][-1]=='b' ? 1 : 2;
	$a[n].delete_at(-1);
	f(i);
end
f(0);

Measured memory_bytes: 1788
H, W = map(int, input().split())
edge = '.' * (W + 2)
C = [edge]
for _ in range(H):
    C.append('.' + input() + '.')
C.append(edge)
for i in range(1, H + 1):
    for j in range(1, W + 1):
        if C[i][j] == '.':
            continue
        if '#' not in [C[i - 1][j], C[i][j - 1], C[i][j + 1], C[i + 1][j]]:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

vector<P>E[100], v;
vector<int>pr[100];
int d[100];
bool used[100][100];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	rep(i, m) {
		int a, b, c; scanf("%d%d%d", &a, &b, &c); a--; b--;
		E[a].push_back(P(c, b));
		E[b].push_back(P(c, a));
		v.push_back(P(a, b));
	}
	rep(i, n) {
		memset(d, 0x3f, sizeof(d));
		rep(j, n)pr[j].clear();
		priority_queue<P, vector<P>, greater<P>>que;
		d[i] = 0; que.push(P(0, i));
		while (!que.empty()) {
			P p = que.top(); que.pop();
			if (d[p.second] != p.first)continue;
			for (P u : E[p.second]) {
				if (d[u.second] > p.first + u.first) {
					d[u.second] = p.first + u.first;
					pr[u.second].clear();
					que.push(P(d[u.second], u.second));
				}
				if (d[u.second] == p.first + u.first)pr[u.second].push_back(p.second);
			}
		}
		rep(i, n) {
			queue<int>que;
			que.push(i);
			while (!que.empty()) {
				int u = que.front(); que.pop();
				for (int v : pr[u]) {
					used[u][v] = true; que.push(v);
				}
			}
		}
	}
	int cnt = 0;
	rep(i, m) {
		if (!used[v[i].first][v[i].second] && !used[v[i].second][v[i].first])cnt++;
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define forn(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;
// A --> 65 ;
// Z --> 90 ;



int main()
{
  int n,pos=0,k=0 ;
  string str ;
  cin >> n >> str ;
  for(int i=0 ; i<str.size() ; i++ ){
      if(str[i]+n <= 90 ){
        str[i] +=n;
      }else{
        k = n-(90-str[i]) ;
        str[i]=64+k ;
      }
  }
cout<<str;
  return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*
int main(){
    int a,b;
    cin >> a >> b;
    if (a<9 && b < 9 ){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}
*/

int main(){
    int a,b; cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 3560
import java.util.Scanner;


public class Main {
	public static void main(String args[]) {

	Scanner std = new Scanner(System.in);

	int N = std.nextInt();
	//List<Integer> list = new ArrayList<>();
	//List<List<Integer>> list = new ArrayList<>();
	int A = std.nextInt();
	int B = std.nextInt();
	//int C = std.nextInt();
	//int temp = 0;

	if(N*A >= B) {
		System.out.println(B);
	}

	else {
		System.out.println(N*A);
	}



	}



}


Measured memory_bytes: 21716
using System;
using System.Linq;
using System.Collections.Generic;

class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var d = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var dic = new Dictionary<int, int>();
        for (int i = 0; i < n; i++)
        {
            if(dic.ContainsKey(d[i]))
            {

            dic[d[i]] = dic[d[i]] + 1;
            }
            else
            {
                dic.Add(d[i], 1);
            }
        }
        var m = int.Parse(Console.ReadLine());
        var t = Console.ReadLine().Split().Select(int.Parse).ToArray();        

        foreach (var item in t)
        {
            if(dic.ContainsKey(item) && dic[item] > 0)
            {
                dic[item]--;
                if(dic[item]==0)
                {
                    dic.Remove(item);
                }
            }
            else
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("YES");
    }
    
}


Measured memory_bytes: 51280
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()
#define Set_union(A, B, res) set_union(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_intersection(A, B, res) set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_difference(A, B, res) set_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_symmetric_difference(A, B, res) set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));

int main() {
	string S;
	cin >> S;
	if (S[S.size() - 1] == 's') S += "es";
	else S += "s";
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 3596
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        while(n!=0) {
            int digit = n%(-2);
            if(n<0 && digit !=0) {
                n += -2;
                digit = 1;
            }
            list.add(digit);
            n/=-2;
        }
        if(list.size()==0) {
            System.out.println(0);
            return;
        }
        Collections.reverse(list);
        Iterator<Integer> itr = list.iterator();
        while(itr.hasNext()) {
            System.out.print(itr.next());
        }
        System.out.println();

    }
}

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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    int n, m;
    cin >> n >> m;
    vector<string>a(n), b(m);
    rep(i, 0, n)cin >> a[i];
    rep(i, 0, m)cin >> b[i];
    for(int i=0; i+m-1<n; i++){
        for(int j=0; j+m-1<n; j++){
            bool p = true;
            rep(k, i, i+m){
                rep(l, j, j+m){
                    if(a[k][l]!=b[k-i][l-j])p = false;
                }
            }
            if(p){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<map>
using namespace std;

int main(){
    string s;
    map<char,int> mp;
    cin >> s;
    for(unsigned i=0;i<s.size();i++){
        auto itr = mp.find(s[i]);
        if(itr == mp.end())mp[s[i]]=0;
        else {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
S = input()
K = int(input())

if len(set(S)) == 1:
    print((len(S) * K) // 2)
    sys.exit()

if S[-1] == S[0]:
    letter = S[0]
    i = 1
    left_count = 1
    while letter == S[i]:
        left_count += 1
        i += 1
    right_count = 1
    i = len(S) - 2
    while letter == S[i]:
        right_count += 1
        i -= 1

    if left_count % 2 == 1 and right_count % 2 == 1:
        ans = K - 1
    else:
        ans = 0

else:
    ans = 0
tmp_count = 1
tmp_ans = 0
for s in range(1, len(S)):
    tmp = S[s]
    if tmp == S[s - 1]:
        tmp_count += 1
        if s == len(S) - 1:
            tmp_ans += tmp_count // 2
    else:
        tmp_ans += tmp_count // 2
        tmp_count = 1
print(tmp_ans * K + ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
	int h, n;
	cin >> h >> n;
	int attack[n];
	int summ = 0;
	for (int i = 0; i < n; i++){
		cin >> attack[i];
	}
	for (int j = 0; j < n; j++){
		summ += attack[j];
	}
	int health = h - summ;
	if (health <= 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n,cmp);
    int sum=0;
    for(int i=0;i<k;i++)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#Gathering Children -D-
s=input()
a=1
data=[0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i]=="R" and s[i]==s[i+1]:
        a+=1
    elif s[i]=="R":
        k=i
        b=a//2
        data[i]+=a-b
        data[i+1]+=b
        a=1
    elif s[i]=="L" and s[i]==s[i+1]:
        a+=1
    else:
        b=a//2
        data[k+1]+=a-b
        data[k]+=b
        a=1
b=a//2
data[k+1]+=a-b
data[k]+=b
print(*data)

Measured memory_bytes: 48064
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

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


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

	int H, W; scanf("%d %d", &H, &W);
	vector<int> cnt(26);
	for (int i = 0; i < H; i++) {
		string s; cin >> s;
		for (int j = 0; j < W; j++) cnt[s[j] - 'a']++;
	}
	if (H % 2 == 0 && W % 2 == 0) {
		for (int i = 0; i < 26; i++) {
			if (cnt[i] % 4 != 0) {
				puts("No");
				return 0;
			}
		}
		puts("Yes");
		return 0;
	}
	if (H % 2 == 0 || W % 2 == 0) {
		if (W % 2 == 0) swap(H, W);
		ll all = H * W;
		ll tmp = 0;
		for (int i = 0; i < 26; i++) {
			if (cnt[i] % 4 == 2) tmp++;
			if (cnt[i] % 2) {
				puts("No");
				return 0;
			}
		}
		if (tmp > H / 2) puts("No");
		else puts("Yes");
	}
	else {
		int tmp = 0;
		for (int i = 0; i < 26; i++) {
			if (cnt[i] % 2) {
				tmp++;
				cnt[i]--;
			}
		}
		if (tmp != 1) {
			puts("No");
			return 0;
		}
		tmp = 0;
		for (int i = 0; i < 26; i++) {
			if (cnt[i] % 4 == 2) tmp++;
		}
		if (tmp > (H - 1) / 2 + (W - 1) / 2) puts("No");
		else puts("Yes");
	}
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz(c)             (ll)c.size()
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define F                 first
#define S                 second
#define copy(a,b)         copy(all(a),back_inserter(b));
#define intersect(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define deb(x) cout << #x << " " << x << endl
#define inf INT_MAX
const ll N = 200010;
const ll MOD = 998244353;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}

void solve(){
    ll a, b, c, d, i = 0;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0){
        if(i%2 == 0) c -= b;
        else a -= d;
        i++;
    }
    if(a > 0) cout << "Yes\n";
    else cout << "No\n";
}

int main(){
    //fin fout
    fast
    ll T = 1; //cin >> T;
    loop(i, 0, T) solve();
}


Measured memory_bytes: 3652
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

struct ProbState {
  bool uresii = false;
  int kanasii = 0;
  int penalty;

  ProbState() {
  }
};

struct Team {
  vector<ProbState> states;
  int id;
  int solved  = 0;
  int penalty = 0;

  Team(int probs, int id)
    : states(probs), id(id) {
  }
};

bool operator<(const Team &a, const Team &b) {
  if (a.solved != b.solved) return a.solved > b.solved;
  return a.penalty < b.penalty;
}

void solve() {
  int t, p, r;
  while (cin >> t >> p >> r, t) {
    vector<Team> ts;
    ts.reserve(t);
    rep(i, t) ts.emplace_back(p, i + 1);
    while (r--) {
      int tid, pid, tm;
      string msg;
      cin >> tid >> pid >> tm >> msg;
      --tid, --pid;
      if (ts[tid].states[pid].uresii) continue;
      if (msg == "CORRECT") {
        ts[tid].states[pid].uresii = true;
        ts[tid].solved++;
        ts[tid].states[pid].penalty = ts[tid].states[pid].kanasii * 1200 + tm;
        ts[tid].penalty += ts[tid].states[pid].penalty;
      }
      if (msg == "WRONG") ts[tid].states[pid].kanasii++;
    }
    stable_sort(all(ts));
    for (Team x : ts) cout << x.id << ' ' << x.solved << ' ' << x.penalty << endl;
  }
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve()
{
  string s;
  cin >> s;
  int N = s.size();
  int cnt = 0;
  dump(s);
  for (int i = 0; i < N;) {
    dump(i, N);
    if (i == N - 1) {
      dump(s[i]);
      cnt++;
      break;
    } else if (i >= N) {
      break;
    }
    if (s[i] == s[i + 1]) {
      if (i < N - 2) {
        cnt += 2;
        dump(s[i]);
        dump(s[i + 1], s[i + 2]);
        i += 3;
      } else {
        cnt += 1;
        dump(s[i], s[i + 1]);
        i += 2;
      }
    } else {
      cnt += 1;
      dump(s[i]);
      i++;
    }
  }
  cout << cnt << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 720
import math

n = int(input())
x_n = list(map(lambda x:int(x),input().split()))


def abs(n):
    if n<0:
        return -1*n
    else:
        return n



def sum(list):
    sum = 0
    for i in list:
        sum = sum + i
    return sum


w = sum(x_n)/n
ceil_w = math.ceil(w)

if abs(ceil_w-w) <= 0.5:
    w =ceil_w
else:
    w = math.floor(w)

energy = 0
for i in x_n:
    energy = energy + (w - i) **2


print(energy)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	char table[3][3];
	char str[100];
	int ans;

	while(fgets(str, 90, stdin) != NULL){
		ans = -1;
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				table[i][j] = str[i*3+j];
			}
		}

		int cnt = 0;
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				if(table[i][j] == 'o') cnt++;
			}
			if(cnt == 3){
				ans = 0;
				break;
			}
			cnt = 0;
		}

		cnt = 0;
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				if(table[i][j] == 'x') cnt++;
			}
			if(cnt == 3){
				ans = 1;
				break;
			}
			cnt = 0;
		}

		cnt = 0;
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				if(table[j][i] == 'o') cnt++;
			}
			if(cnt == 3){
				ans = 0;
				break;
			}
			cnt = 0;
		}

		cnt = 0;
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				if(table[j][i] == 'x') cnt++;
			}
			if(cnt == 3){
				ans = 1;
				break;
			}
			cnt = 0;
		}

		cnt = 0;
		for(int i=0; i<3; i++){
			if(table[i][i] == 'o') cnt++;
		}
		if(cnt == 3) ans = 0;

		cnt = 0;
		for(int i=0, j=2; i<3, j>=0; i++, j--){
			if(table[i][j] == 'o') cnt++;
		}
		if(cnt == 3) ans = 0;

		cnt = 0;
		for(int i=0; i<3; i++){
			if(table[i][i] == 'x') cnt++;
		}
		if(cnt == 3) ans = 1;

		cnt = 0;
		for(int i=0, j=2; i<3, j>=0; i++, j--){
			if(table[i][j] == 'x') cnt++;
		}
		if(cnt == 3) ans = 1;

		if(ans == 0) printf("o\n");
		else if(ans == 1) printf("x\n");
		else printf("d\n");
	}

	return 0;
}

Measured memory_bytes: 0
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 3e5 + 2;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}

ll r[Max+5],c[Max+5];

//ll mp[3000000];
ll mp[Max+5];
void soln()
{
    ll i,j,n,m,p,a,sum=0,k,t,b,d,cnt=0,q,l;

      bool flag=false;



      scanf("%d %d %d",&n,&m,&t);




      ll ex=n+m+1;

      set<pll>tt;

      ll mxc=-1,mxr=-1;

      ll ans1=1,ans2=1;
      for(i=0; i<t; i++)
      {
       scanf("%d %d",&a,&b);

         r[a]++;
         c[b]++;

        if(mxr<r[a])
            {
                mxr=r[a];

                ans1=a;
            }

        if(mxc<c[b])
            {
                mxc=c[b];
                ans2=b;
            }



      tt.insert({a,b});


      }

      mxr=ans1;
      mxc=ans2;


      ll mx=0;
      for(i=mxr; i<=mxr; i++)
      {
          for(j=1; j<=m; j++)
          {
              sum=r[i]+c[j];



            if(tt.count({i,j}))sum--;

              mx=max(sum,mx);
          }
      }
        for(i=1; i<=n; i++)
      {
          j=mxc;

              sum=r[i]+c[j];



            if(tt.count({i,j}))sum--;

              mx=max(sum,mx);

      }
 printf("%d\n",mx);


}
int main()
{

   fastread();

   soln();
}



Measured memory_bytes: 20196
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()


Measured memory_bytes: 7004
n=int(input())
time=0
tasks=[]
for i in range(n):
  tasks.append(list(map(int,input().split())))
tasks.sort(key=lambda x:x[1])
flag=0
for i in range(n):
  time+=tasks[i][0]
  if time>tasks[i][1]:
    flag=1
    break
if flag==0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 53720
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()

import math

def sieve_of_eratosthenes(n):
    prime_list = []  # n以下の素数のリスト
    A = [1]*(n+1)    # A[i] = iが素数なら1,その他は0
    A[0] = A[1] = 0
    for i in range(2,math.floor(math.sqrt(n))+1):
        if A[i]:
            prime_list.append(i)
            for j in range(i**2,n+1,i):
                A[j] = 0
    for i in range(math.floor(math.sqrt(n))+1,n+1):
        if A[i] == 1:
            prime_list.append(i)
    return prime_list

primelist = sieve_of_eratosthenes(N)

list = [i for i in range(N+1)]

for p in primelist:
    a = p
    r = 2
    while a <= N:
        for i in range(1,N//a+1):
            if i % p == 0:
                continue
            else:
                list[a*i] *= r
        a *= p
        r += 1

print(sum(list))

Measured memory_bytes: 251216
//============================================================================
// Name        : AOJ.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>

using namespace std;

int n;
int d[300001]={};

int main() {
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>d[i];
	}
	int d1=0;
	int flg=0;
	for(int i=0;i<n;++i){
		d1=max(d1,10*i+d[i]);
		if(d1<10*(i+1))flg=1;
	}
	d1=10*(n-1);
	for(int i=n-1;i>=0;--i){
		d1=min(d1,10*i-d[i]);
		if(d1>10*(i-1))flg=1;
	}

	if(flg==0){
		cout<<"yes"<<endl;
	}else{
		cout<<"no"<<endl;
	}
		return 0;
}

Measured memory_bytes: 4268
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n; ll d;
    cin >> n >> d;

    int ans = 0;
    rep(i, n) {
        ll x, y; cin >> x >> y;
        if (x*x + y*y <= d*d) ans++;
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const int mod = 1e9 + 7;

int main(){
    int x, y;
    cin >> x >> y;
    bool flag = false;
    for (int i = 0; i <= x; ++i) {
        if (y == i * 2 + (x - i) * 4){
            flag = true;
            break;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

import collections
def counter_list(A):
  counter = collections.Counter(A)
  counter =  [list(e) for e in counter.items()]
  #counter.sort() #sortしたい場合はつける
  return counter

#(方針)
#奇数個の重複 → 1個にできる 
#偶数個の重複(=奇数個の重複 +1)　→ 2個にできる 
#2個の重複が2ペア → 重複なし2ペアにできる
A = counter_list(A)
counter2 = 0 #2個重複のペアの個数
for i in range(len(A)):
  if(A[i][1]%2 == 1): A[i][1] = 1
  elif(A[i][1]%2 == 0): A[i][1] = 2
  if(A[i][1] == 2): counter2 += 1
    
if(counter2 % 2 == 0): ans = len(A)
elif(counter2 %2 == 1): ans = len(A)-1
print(ans)

Measured memory_bytes: 25564
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string n;
    cin >> n;
    bool hantei = false;
    rep(i,3){
        if(n.at(i) == '7') hantei =true;
    }
    if(hantei) cout << "Yes" << endl;
    else   cout << "No" << endl;
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10**6) # while文の回数上限

N = int(input())
G = [list() for _ in range(N)]
E = list()
D = dict()

for _ in range(N-1):
  a,b = map(int, input().split())
  a -= 1; b -= 1;
  G[a].append(b)
  G[b].append(a)
  if a > b:
    a,b=b,a
  E.append((a,b))

k = max(len(G[i]) for i in range(N))

q = [(0,-1,-1)]
while q:
  cc = 1
  v,p,c = q.pop()
  for x in G[v]:
    if x == p:
      continue
    if cc == c:
      cc += 1
    if v<x:
      D[(v,x)] = cc
    else:
      D[(x,v)] = cc
    q.append((x,v,cc))
    cc += 1

print(k)
for i in E:
  print(D[i])

Measured memory_bytes: 43360
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	int n;
  	string s;
  	cin >> n >> s;
  	for(int i=0;i<s.size();i++){
   		int temp=(int)s[i];
      	temp+=n;
      	if(temp<=90)
          	s[i]=(char)temp;
      	else
          	s[i]=(char)(temp-26);
    }
  	cout << s;
  	return 0;
}


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

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef int64_t i64;
typedef uint64_t u64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using namespace std;

int main() {

	const int N = read_item();
	int count = 0;

	for(auto _ : range(N)) {
		int d1 = read_item();
		int d2 = read_item();
		if(d1 == d2) {
			count += 1;
		} else {
			count = 0;
		}
		if(count >= 3) {
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 3624
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        if(n%2 == 0 && s.substring(0, n/2).equals(s.substring(n/2))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();

    }

}


Measured memory_bytes: 35512
#include <bits/stdc++.h>
using namespace std;
int H,W,sx,sy,gx,gy;
string s[1000];
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
int d[1000][1000];
int INF=1<<30;
main()
{
    cin>>H>>W;
    cin>>sx>>sy;
    cin>>gx>>gy;
    --sx;--sy;--gx;--gy;
    for(int i=0;i<H;++i)cin>>s[i];
    for(int i=0;i<H;++i)for(int j=0;j<W;++j)d[i][j]=INF;
    d[sx][sy]=0;
    deque<pair<int,int>> q;
    q.push_back({sx,sy});
    while(!q.empty())
    {
        int x=q.front().first;
        int y=q.front().second;
        q.pop_front();
        for(int i=0;i<4;++i)
        {
            int nx=x+dx[i];
            int ny=y+dy[i];
            if (nx<0||ny<0||nx>=H||ny>=W||s[nx][ny]=='#'||d[nx][ny]<=d[x][y])continue;
            d[nx][ny]=d[x][y];
            q.push_front({nx,ny});
        }
        for(int i=-2;i<=2;++i)for(int j=-2;j<=2;++j)
        {
            int nx=x+i;
            int ny=y+j;
            if (nx<0||ny<0||nx>=H||ny>=W||s[nx][ny]=='#'||d[nx][ny]<=d[x][y]+1)continue;
            d[nx][ny]=d[x][y]+1;
            q.push_back({nx,ny});
        }
    }
    cout<<(d[gx][gy]==INF?-1:d[gx][gy])<<endl;
}

Measured memory_bytes: 9460