akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

#define MAX 100005
#define NIL -1


struct Node{

  int p;
  int l;
  int r;

}

  Node ,T[MAX];

int  n, D[MAX];

  void print(int u){

    int i,c;

    printf("node %d: ",u);
    printf("parent = %d, ",T[u].p);
     printf("depth = %d,",D[u]);

     if(T[u].p == NIL )printf(" root, ");
     else if(T[u].l == NIL )printf(" leaf, ");
     else printf(" internal node, ");

     printf("[");

     for( i = 0, c = T[u].l; c!= NIL; i++, c = T[c].r){
       if (i) printf(", ");
       printf("%d",c);
     }
     printf("]\n");
  }


int rec(int u, int p){
  D[u] = p;
  if (T[u].r !=NIL) rec(T[u].r, p);
  if (T[u].l !=NIL) rec(T[u].l, p + 1);
}

int main(){                              
  int i,j,d,v,c,l,r;                     
  scanf("%d",&n);
  for( i = 0; i < n; i++ ){

    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;

  }

  for( i=0; i < n; i++){
    scanf("%d%d",&v,&d);
    for(j =0;j<d; j++){
      scanf("%d",&c);
      if(j==0)T[v].l =c;
      else T[l].r =c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i<n;i++){

    if(T[i].p ==NIL) r=i;
  }

  rec(r,0);

  for(i=0;i<n;i++)print(i);

  return 0;
}



Measured memory_bytes: 6404
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;

namespace abc113_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int M = input[1];
            int[][] arr = new int[M][];
            var count = new int[N+1];

            for (int i = 0; i < M; i++)
            {
                int[] tmp = ReadLine().Split().Select(int.Parse).ToArray();
                arr[i] = new int[4];
                arr[i][0] = tmp[0];
                arr[i][1] = tmp[1];
                arr[i][2] = i;
            }

            Array.Sort(arr, (a,b) => a[1]-b[1]);

            for (int i = 0; i < M; i++)
            {
                var tmp = arr[i][0];
                count[tmp]++;
                arr[i][3] = count[tmp];
            }

            Array.Sort(arr, (a,b) => a[2]-b[2]);


            for (int i = 0; i < M; i++)
            {
                string left = arr[i][0].ToString();
                left = left.PadLeft(6,'0');
                string right = arr[i][3].ToString();
                right = right.PadLeft(6,'0');
                WriteLine(left+right);
            }
        }
    }
}

Measured memory_bytes: 26524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

lli IsPrime(lli num)
{
  lli a=0;
    double sqrtNum = sqrt(num);
    for (lli i = 2; i <= sqrtNum; i ++)
    {
        if (num % i == 0)
        {
          a=max(a,i);
        }
    }
  if(a) // 素数ではない
            return a;

    // 素数である
    return num;
}


int main(){
  int N;
  string s,t;
  cin >>N>>s>>t;
  rep(i, N)
    cout << s[i] << t[i];
  cout << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

int main(){
    ll x;cin>>x;
    ll tmp=100;
    int ans=0;
    while(tmp<x){
        tmp*=1.01;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define REP(i, n) for(int i=0;i<(n);++i)
#define MOD 1e9+7;
typedef long long ll;

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

	int n, l[10], sum = 0, max = -1;
	cin >> n;
	REP(i, n) {
		cin >> l[i];
		sum += l[i];
		if(max < l[i]) max = l[i];
	}
	if(max < sum-max) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include <algorithm>
using namespace std;

int main(){

  long N;
  cin >> N;
  
  vector<string> s(N);
  vector<long> t(N);
  for(int i=0; i<N; i++)
    cin >> s[i] >> t[i];

  string X;
    cin >> X;
  
  int i;
  for(i=0; i<N; i++)
    if(s[i] == X)  break;
    
  long ans = 0;
  for(int j = i+1; j<N; j++)
    ans += t[j];
    
  cout << ans;
  
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
a = []
b = []
Adj = Struct.new(:id, :l)
adj = []
N.times do |i|
  adj[i] = Adj.new(i, [])
end
  
M.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
  adj[a[i]-1].l.push(b[i]-1)
  adj[b[i]-1].l.push(a[i]-1)
end

$checked = []
$checked = $checked.fill(false,0..N-1)


def bfs(v,adj)
  # 答えの配列
  ans = {}
  # bfs用のキュー
  que = []
  # 現在の点をキュー末尾に追加
  que.push(v)
  $checked[v] = true
  # キューが空でない間続ける
  while que.size != 0
    # puts "#{que}"
    # キューの先頭を取り出し
    v = que.shift
    # vから行ける点全てに対して
    adj[v].l.each do |u|
      if $checked[u] == false
        $checked[u] = true
        ans[u] = v+1
        que.push(u)
      end
    end
  end
  return ans
end

ans = bfs(0, adj)

1.upto(N-1) do |i|
  if ans[i].nil?
    puts "No"
    exit
  end
end

puts "Yes"
1.upto(N-1) do |i|
  puts ans[i]
end

Measured memory_bytes: 46472
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int tzcnt(uint x) {
    return popcount(~x & x - 1);
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};

ll ans[100];

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

    int N;

    cin >> N;
    
    out(N / 3);

    int aaa;
    cin >> aaa;
}

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


int main(){
  int x;
  //int n=0,i=0,d=0,x=1,y=1,z=1,m=0;//a[200000],j=0;
  //char s[200000];
  
  scanf("%d",&x);
  //printf("%d\n",x);
  if(x<=599)
    printf("8\n");
  else if(600<=x && x<=799)
    printf("7\n");
  else if(800<=x && x<=999)
    printf("6\n");
  else if(1000<=x && x<=1199)
    printf("5\n");
  else if(1200<=x && x<=1399)
    printf("4\n");
  else if(1400<=x && x<=1599)
    printf("3\n");
  else if(1600<=x && x<=1799)
    printf("2\n");
  else if(1800<=x && x<=1999)
    printf("1\n");
  return 0;
}

Measured memory_bytes: 1644
n,q = map(int,input().split())
s = input()
lis = [list(map(int,input().split())) for _ in range(q)]
rui = []
for i,ss in enumerate(s):
    if i == 0:
        rui.append(0)
    else:
        if ss == 'C' and  s[i-1] == 'A':
            rui.append(rui[-1]+1)
        else:
            rui.append(rui[-1])
#print(rui)
for l in lis:
    print(rui[l[1]-1]-rui[l[0]-1])

Measured memory_bytes: 30616
n = gets.chomp.to_i
mochi_arr = Array.new(n, 0)
(0 .. n - 1 ).each do |i|
    mochi_arr[i] = gets.chomp.to_i
end

chk_arr = mochi_arr.sort
count = 0
(0 .. n - 1).each do |j|
    if j == 0 then
        count += 1
    elsif chk_arr[j] != chk_arr[j - 1] then
        count += 1
    end
end

print ("#{count}\n")

Measured memory_bytes: 1788
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var input = Reads();
        var n = input[0];
        var m = input[1];
        var a = input[2];
        var b = input[3];
        var x = new long[n];
        var y = new long[m];
        
        input = Reads();
        for(int i = 0; i < n; i++)
        {
            x[i] = input[i];
        }
        
        input = Reads();
        for (int i = 0; i < m; i++)
        {
            y[i] = input[i];
        }
        bool c = false;
        for(long i = a + 1; i <= b; i++)
        {
            if (x.Max() < i && y.Min() >= i)
                c = true;
        }
        if (!c)
            Console.WriteLine("War");
        else
            Console.WriteLine("No War");
        
        Console.Out.Flush();
    }
}



Measured memory_bytes: 13396
from itertools import accumulate as ac
from collections import Counter as c
n,m=map(int,input().split())
d=c([i%m for i in [0]+list(ac(list(map(int,input().split()))))])
a=0
for i in d.values():
    if i>1:
        a+=i*(i-1)//2
print(a)

Measured memory_bytes: 14356
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <vector>

int main(){
  long long X;
  scanf("%lld", &X);
  long long money = 100;
  int year = 0;
  while(money<X){
    money = money*1.01;
    year++;
  }
  std::cout << year << std::endl;
  return 0;
}


Measured memory_bytes: 3252
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);

        var xx = new List<X>();

        spl = input.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
            xx.Add(new X() { i = i, x=int.Parse(spl[i]) });

        xx.Sort((x, y) => x.x - y.x);

        var centers = new int[n];
        int center = n / 2;

        for(int i=0; i<n; i++) {
            var subidx = xx[i].i;
            var x = (i < center) ? xx[center] : xx[center - 1];
            centers[subidx] = x.x;
        }

        var buil = new StringBuilder();
        foreach (var i in centers) {
            buil.AppendLine(i.ToString());
        }

        return buil;
    }

    class X
    {
        public int i;
        public int x;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 47492
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <bits/stdc++.h>
using namespace std ;
#define printshosu(a) cout << fixed << setprecision(15) << a << endl;
int main(){
  int S,W;
  cin >>S>>W;
  if(S>W){
    cout<<"safe"<<endl;
  }else{
    cout<<"unsafe"<<endl;
  }
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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 (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

int main(){
    vector<pair<ll,ll>>a;
    SS(ll,n);
    rep(i,n) {
        SS(ll,A,B);
        a.push_back({A,B});
    }
    ll nowtime=0;
    bool flag=true;
    sort(a.begin(),a.end(),cmp);
    rep(i,n){
        nowtime+=a[i].first;
        if(nowtime>a[i].second)flag=false;
    }
    Yes(flag);
}

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

using namespace std;

int main() {

    int y, m, d;
    int ymd;

    while(cin >> y >> m >> d) {

        ymd = y* 10000 + m * 100 + d;

        if(ymd >= 18680908 && ymd <= 19120729) {
            cout << "meiji" << " " << (ymd / 10000) - 1868 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19120730 && ymd <= 19261224) {
            cout << "taisho" << " " << (ymd / 10000) - 1912 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19261225 && ymd <= 19890107) {
            cout << "showa" << " " << (ymd / 10000) - 1926 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19890108) {
            cout << "heisei" << " " << (ymd / 10000) - 1989 + 1 << " " << m << " " <<  d << endl;
        } else {
            cout << "pre-meiji" << endl;
        }

    }

}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PA;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main(){	
	long long N;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<ll> Y(M-1+1);
	vector<ll> P(M-1+1);
	priority_queue<PA, vector<PA>, greater<PA> > que[N];
	for(ll i = 0 ; i <= M-1 ; i++){
		cin >> P[i];
		cin >> Y[i];
		P[i]--;
		que[P[i]].push(PA(Y[i],i));
	}
	vector<ll> num(M);
	rep(i, N) {
		ll c=1;
		while (!que[i].empty()) {
			num[que[i].top().second] = c;
			c++;
			que[i].pop();
		}
	}
	rep(i, M) {
		printf("%06lld", P[i]+1);
		printf("%06lld\n", num[i]);
	}
	return 0;
}



Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 1LL<<60;
/////////////////////////////////
int main(){
    int x,n;
    cin >> x >> n;
    int p[110];
    rep(i, 110) p[i] = i;
    rep(i,n){
        int k;
        cin >> k;
        p[k] = 0;
    }
    int cnt = 20000;
    int ans;
    for (int i = 101; i >= 0;i--){
        cnt = min(cnt, abs(x - p[i]));
        if(cnt==abs(x-p[i]))
            ans = i;
    }
    cnt = min(cnt, abs(x + 1));
    if(cnt==abs(x+1))
        ans = -1;
    cout << ans << endl;
}

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

using namespace std;

int n, sum, a, b;

int main()
{
	
	sum = 1;
	cin >> a >> b;
    if (a <= 0 and b >= 0) {
    	cout <<"Zero";
    	return 0;
	}
	if (a > 0 ) {
		cout <<"Positive";
		return 0;
	}
	n = b - a + 1;
	if (n % 2 == 0) {
		cout << "Positive";
	}
	else{
		cout <<"Negative";
	}
}

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

using namespace std;

#define REP(i,a,b) for(ll i = a; i < b; i++)
#define DB( x ) cout << #x << " = " << x << endl;
#define sz(s) ((int)((s).size()))
#define endl '\n'

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef pair<int, pii> tri;
typedef vector <vector <ll>> matrix;
typedef pair<string, string> pss;

const ll mod = (ll)1e9 + 7;
const int MAX = (int)1e6 + 100;

const ll oo = 0x3f3f3f3f3f3f3f3f;

ll dp[MAX], a[MAX];

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

    memset(dp, oo, sizeof(dp));

    int n; cin >> n;

    dp[1] = 0;

    for(int i = 1;i <= n;++i){
        cin >> a[i];
    }

    for(int i = 2;i <= n;++i){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i]);
        if(i - 2 >= 1){
            dp[i] = min(dp[i - 2] + abs(a[i] - a[i - 2]), dp[i]);
        }
    }

    cout << dp[n] << endl;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int a[N],b[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    for(int i=0;i<N;i++){
        cin >> b[i];
    }

    for(int i=1;i<N;i++){
        a[i] = a[i]+a[i-1];
    }

    reverse(b,b+N);
    for(int i=1;i<N;i++){
        b[i] = b[i]+b[i-1];
    }

    int ans = 0;
    for(int i=0;i<N;i++){
        int tmp =  a[i]+b[N-1-i];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

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

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b & (1LL << i)) != 0) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long mod = 1000003;
long long fact[3000003], inv[1000007];

void init() {
	for (int i = 0; i < 1000003; i++) inv[i] = modpow(i, mod - 2, mod);
	fact[0] = 1;
	for (int i = 1; i <= 3000000; i++) fact[i] = (1LL * fact[i - 1] * i) % mod;
}

long long query(long long N, long long X, long long D) {
	if (D == 0) {
		return modpow(X, N, mod);
	}
	if (N >= 1000003) return 0;
	if (X == 0) return 0;

	long long E1 = (X * inv[D]) % mod; // 初項が何番目か
	long long P1 = fact[E1 + N - 1];
	long long P2 = fact[E1 - 1];
	long long P3 = modpow(P2, mod - 2, mod);
	long long P4 = modpow(D, N, mod);
	return ((P1 * P3 % mod) * P4 % mod);
}

int main() {
	init();
	int Q, n, x, d;
	cin >> Q;
	for (int i = 1; i <= Q; i++) {
		cin >> x >> d >> n;
		cout << query(n, x, d) << endl;
	}
	return 0;
}

Measured memory_bytes: 32128
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,i,j,flg[1001],a;
	scanf("%d",&x);
	flg[1]=1;
	for(i=2;i<=x;i++)	flg[i]=0;
	for(i=2;i*i<=x;i++)	{
		a=i;
		while(1)	{
			a=a*i;
			if(a>x)	break;
			flg[a]=1;
		}
	}
	for(i=x;i>=1;i--)	{
		if(flg[i]==1)	{
			a=i;	break;
		}
	}
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128
list = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
n = int(input())
S = input()
k = []
p = []
ans = ""
for i in range(len(S)):
    k.append(S[i])
for i in range(len(k)):
       for j in range(26):
           if k[i] == list[j]:
              p.append(list[j+n])
for i in range(len(k)):
    ans += p[i]
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int V[N], C[N];
    for(int i = 0; i < N; i++){
        cin >> V[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    int sum = 0;
    for(int i = 0; i < N; i++){
        if(V[i]-C[i] > 0) sum+=V[i]-C[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int strlen(int64_t c) {
   int ans=0;
   while(c>0){
     ans++;
     c=c/10;
   }
   return ans;
}

int main() {
  int n;
  cin >> n;
  vector<int64_t> vec(n);
  rep(i,n) cin >> vec[i];
  int64_t ans=1;
  sort(vec.begin(),vec.end());
  if(vec[0]==0) ans=0;
  else{
      rep(i,n){
      if(strlen(ans)+strlen(vec[i])>=20&&ans*vec[i]!=1000000000000000000LL){
        ans=-1;
        break;
      }
      ans*=vec[i];
      if(ans>1000000000000000000LL){
        ans=-1;
        break;
      }
    }
    
  }
  cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<int> W(N);
    REP(i,N) cin >> W[i];

    int s1 = 0;
    int s2 = 0;
    REP(i,N) s2 += W[i];

    int ans = INF;
    
    REP(i,N){
        ans = min(ans, abs(s1-s2));
        s1 += W[i];
        s2 -= W[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  ll c;
  cin >> n >> c;
  vector<ll> x(n);
  vector<int> v(n);
  vector<ll> vsuml(n+1);
  vector<ll> vsumr(n+1);
  vector<ll> f(n+1);
  vector<ll> f2(n+1);
  rep(i, n){
    cin >> x[i] >> v[i];
    vsuml[i+1]=vsuml[i]+v[i];
    f[i+1]=max(vsuml[i+1]-x[i], f[i]);
  }
  for(int i=n-1; i>=0; i--){
    vsumr[i]=vsumr[i+1]+v[i];
    f2[i]=max(vsumr[i]-(c-x[i]), f2[i+1]);
  }
  ll ans=0;
  for(int i=n; i>0; i--){
    ll num=0;
    if(i==n){
      num+=f[n];
    } else {
      num+=vsumr[i]-2*(c-x[i]);
      num+=f[i];
    }
    ans=max(ans, num);
  }
  for(int i=0; i<=n; i++){
    ll num2=0;
    if(i==0){
      num2+=f2[0];
    } else {
      num2+=vsuml[i]-2*x[i-1];
      num2+=f2[i];
    }
    ans=max(ans, num2);
  }
  cout << ans << endl;
  return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  set<vector<int>> st;

  while (1) {
    if (a % 2 || b % 2 || c % 2) break;
    int _a = (b + c) / 2;
    int _b = (a + c) / 2;
    int _c = (a + b) / 2;
    a = _a;
    b = _b;
    c = _c;
    vector<int> v = {a, b, c};
    if (st.find(v) != st.end()) {
      cout << "-1" << endl;
      return 0;
    }
    st.insert(v);
  }

  cout << st.size() << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef char String[1024];

int main(void)
{
  int A=0;
  String N;
scanf("%s",N);
  for (int i=0;i<3;i++){
    if(N[i]=='7'){
    A++;
    }
  }
  if(A>0)
    printf("Yes");
  else
    printf("No");
  return 0;
}

Measured memory_bytes: 1728
#include<stdio.h>
#include<stdlib.h>

#define INFINITY 2000000000

int cnt=0;
long long count=0;

void merge(int* a,int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	int L[n1+1],R[n2+1];
	for(int i=0;i<n1;i++){
		L[i]=a[left+i];
	}
	for(int i=0;i<n2;i++){
		R[i]=a[mid+i];
	}
	L[n1]=INFINITY;
	R[n2]=INFINITY;
	int i=0;
	int j=0;
	for(int k=left;k<right;k++){
		cnt++;
		if(L[i]<=R[j]){
			a[k]=L[i];
			i=i+1;
		}else{
			a[k]=R[j];
			j=j+1;
			count+=n1-i;
		}
	}
}

void msort(int* a,int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		msort(a,left,mid);
		msort(a,mid,right);
		merge(a,left,mid,right);
	}
}

int main(void){

	int n;
	scanf("%d",&n);
	int* s=(int*)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	
	msort(s,0,n);
	
	printf("%lld\n",count);
	/*
	for(int i=0;i<n;i++){
		printf("%d",s[i]);
		if(i!=n-1)printf(" ");
	}
	printf("\n%d\n",cnt);
	*/
	return 0;

}


Measured memory_bytes: 3328
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h,a = m()

b = l()

if sum(b) >= h:
    print("Yes")
else:
    print("No")






Measured memory_bytes: 53720
n, m = map(int, input().split())
lrl = list(list(map(int, input().split())) for _ in range(m))
lmax = 0
rmin = n

for lr in lrl:
    if lr[0] > lmax:
        lmax = lr[0]
    if lr[1] < rmin:
        rmin = lr[1]
if lmax <= rmin:
    print(rmin-lmax+1)
else:
    print(0)





Measured memory_bytes: 27340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "Yes\n"
#define N cout << "No\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i, n) for (int i = 0; i < n; i++)
#define RE(i, a, b) for (int i = a; i >= b; i--)

long long mod = 1000000007 , ans = 1 ;
int p(long long a , long long b)
{
    while(b)
    {
        if(b%2)
        {
            ans = ( (ans%mod)*(a%mod) ) %mod ;
        }
        a = ((a%mod)*(a%mod))%mod ;
        b /= 2 ;
    }
    return ans ;
}


int prime[1000010] ;
void fun()
{
	for (int i = 2; i < 1000001; i++)
	{
		if (prime[i] == 0)
		{
			for (int j = i + i; j < 1000001; j += i)
			{
				prime[j] = 1;
			}
		}
	}
}
int gcd(ll a,ll b)
{
     if(b == 0)
     {
          return a ;
     }
     return gcd(b,a%b) ;
}
int main()
{
     // ios_base::sync_with_stdio(false);
     // cin.tie(NULL);
     int n , m , a[200010] = {0} ;
     cin >> n >> m ;
     vector <int> v[n+1] ;
     R(i,m)
     {
          int x , y ;
          cin >> x >> y ;
          v[x].push_back(y) ;
          v[y].push_back(x) ;
     }
     int max = 0 ;
     for(int i = 1 ; i <= n ; i++)
     {
          int cnt = 1 ;
          if(a[i] == 0)
          {
               a[i] = 1 ;
               for(int j = 0 ; j < v[i].size() ; j++ )
               {
                    if(a[v[i][j]] == 0)
                    {
                         cnt++ ;
                         a[v[i][j]] = 1 ;
                         for(int k = 0 ; k < v[v[i][j]].size() ; k++)
                         {
                              v[i].push_back(v[v[i][j]][k]) ;
                         }
                    }
               }
               if(cnt > max)
               {
                    max = cnt ;
               }
          }
     }
     cout << max << endl ;
}


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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}
int n, m, q;
int que[50][4];

int inEqual(vi &v)
{
    int res = 0;
    For(i, q)
    {
        if (v[que[i][1]] - v[que[i][0]] == que[i][2])
            res += que[i][3];
    }
    return res;
}

int calc(vi &v, int ind, int val)
{
    //cout << ind << " ";
    if (ind == n)
        return inEqual(v);
    int res = 0;
    Rep(i, val, m)
    {
        v[ind] = i;
        //cout << v[ind] << " ";
        res = max(res, calc(v, ind + 1, i));
    }
    return res;
}

int main()
{
    cin >> n >> m >> q;
    For(i, q)
    {
        For(j, 4) cin >> que[i][j];
        que[i][0]--;
        que[i][1]--;
    }
    vi v(n, -1);

    cout << calc(v, 0, 1) << endl;

    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <map>
 
using namespace std;
const int maxn=500000+5;
map<int,int> mp;
int d[maxn];
int a[maxn];
int ans[500000+5];
struct node{
    int l,r,id;
    bool operator<(node t)const{
        return r<t.r;
    }
}q[500000+5];
int sum(int i){
    int ans=0;
    while(i>0){
        ans+=d[i];
        i-=i&-i;
    }
    return ans;
}
void add(int i,int x){
    while(i<maxn){
        d[i]+=x;
        i+=i&-i;
    }
}
 
int main()
{
    int n, m;
    scanf("%d",&n); scanf("%d",&m);
	fill(d,d+n+2,0);
	mp.clear();
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<m;i++){
		scanf("%d%d",&q[i].l,&q[i].r);
		q[i].id=i;
	}
	sort(q,q+m);
	int pre=1;
	for(int i=0;i<m;i++){
		for(int j=pre;j<=q[i].r;j++){
			if(mp[a[j]]!=0){
				add(mp[a[j]],-1);
			}
			add(j,1);
			mp[a[j]]=j;
		}
		pre=q[i].r+1;
		ans[q[i].id]=sum(q[i].r)-sum(q[i].l-1);
	}
	for(int i=0;i<m;i++){
		printf("%d\n",ans[i]);
	}
    return 0;
}


Measured memory_bytes: 38928
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
	SpeedForce;
	cin >> n >> m;
	For (i, 1, n) cin >> a[i];
	For (i, 1, m) {
		int l, r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}

	For (i, 1, n) {
		cur = -inf;
		for (auto j : g[i])
			cur = max(cur, a[j]);
		if (cur < a[i]) ++ans;
	}
	cout << ans << '\n';

	return Accepted;
}

// B...a

Measured memory_bytes: 20908
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
      	int A=sc.nextInt();
      	int B=sc.nextInt();
      	if (A>=13){
        System.out.println(B);
        } else if (A>=6 && A<=12){
        System.out.println(B/2);
        }else{
        System.out.println(0);
        }
        
        
    }
}

Measured memory_bytes: 22868
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]

Y = sorted(X, key=lambda x:x[0])
Z = sorted(X, key=lambda x:x[1])

ans = 0
if N % 2:
    ans = Z[N//2][1]-Y[N//2][0]+1

else:
    ans = Z[N//2][1]-Y[N//2][0]+1
    ans += Z[N//2-1][1]-Y[N//2-1][0]

print(ans)


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

const int MAXN = 205, MAXM = 45;

long long n;

long long C[MAXM][MAXM];
int v[MAXM];

int main()
{
	cin >> n;
	long long cur = 0;
	int len;
	for (int i = 1; ; i++) {
		if ((1ll<<(i-1))-1 <= n) cur = (1ll<<(i-1))-1, len = i;
		else break;
	}
	C[0][0] = 1;
	for (int i = 1; i <= len; i++) {
		C[i][0] = 1;
		for (int j = 1; j <= i; j++)
			C[i][j] = C[i-1][j]+C[i-1][j-1];
	}
	n -= cur;
	int pos = len/2;
	for (int i = pos; i >= 0; i--) {
		while (n >= C[len][i])
			v[i]++, n -= C[len][i];
	}
	int cnt = 0;
	for (int i = 0; i <= pos; i++) {
		cnt += v[i];
	}
	if (cnt*2+len > 200) throw;
	cout << cnt*2+len << endl;
	for (int i = 0, cur = cnt; i < len; i++) {
		while (v[i]) {
			cout << (cur--) << " ";
			v[i]--;
		}
		cout << cnt+1 << " ";
	}
	for (int i = 1; i <= cnt; i++)
		cout << i << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
#include <algorithm>

using namespace std;

const int INF = 1e6;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(30, 1);
    for (int i=0; i<n; i++){
        a[s[i]-'a']++;
    }
    long long int ans=1;
    for (int i=0; i<30; i++){
        ans *= a[i];
        ans = ans%1000000007;
    }

    cout << ans-1 << endl;
}


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

int main(){
	// sengen
	int n;
	int dp[100010];
	// nyuryoku
	cin >> n;
	// keisan
	for(int i=1;i<=n;i++) dp[i] = INT_MAX;
	dp[0] = 0;
	for(int i=1;i<=n;i++){
		int d = 1;
		while(d <= i){
			dp[i] = min(dp[i],dp[i-d] + 1);
			d *= 6;
		}

		d = 1;
		while(d <= i){
			dp[i] = min(dp[i],dp[i-d] + 1);
			d *= 9;
		}
	}
	// syutsuryoku
	cout << dp[n] << endl;
}

Measured memory_bytes: 640
n = int(input())
building_list = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for _ in range(n):
    b, f, r, v = map(int,input().split())
    building_list[b-1][f-1][r-1] += v

for _b in range(4):
    for _f in range(3):
        for _r in range(10):
            print(' ', end='')
            print(building_list[_b][_f][_r], end='')
        print('')
    if _b != 3:
        print('#'*20)


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long k,a,b;
  cin >> k >> a >>b;
  long long k2 = k;
  long long bis=1,m=0;
    k-=a-1;
  if(k<=1){cout << 1+k2 << endl;
          return 0;}
    if(k%2==0){
      bis=b,m=1,k-=2;
      bis+=(k/2)*(b-a);
    }else{
      bis=b,m=1,k-=2;
      bis+=(k/2)*(b-a)+1;
    }
  cout << max(bis,1+k2) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        var abcd = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int a = abcd[0], b = abcd[1], c = abcd[2], d = abcd[3];
        if (a * b >= c * d) Console.WriteLine(a * b);
        else Console.WriteLine(c * d);
    }
}

Measured memory_bytes: 27344
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int i;
  int t,n;
  while(cin>>t>>n,t||n){
    int a[128][128]={};
    for(i=0;i<n;i++){
      int x,y;
      cin>>x>>y;
      x+=64;
      y+=64;
      a[y][x]=-1;
    }
    int sx,sy;
    cin>>sx>>sy;
    sx+=64;
    sy+=64;
    int b[128][128];
    memset(b,-1,sizeof(b));
    queue<pair<pair<int,int>,int> > c;
    c.push(make_pair(make_pair(sx,sy),0));
    int ct=0;
    while(c.empty()==0){
      int x,y,z;
      x=c.front().first.first;
      y=c.front().first.second;
      z=c.front().second;
      c.pop();
      if(z>t)
	break;
      if(b[y][x]){
	b[y][x]=0;
	ct++;
	if(a[y+1][x+1]==0&&b[y+1][x+1])
	  c.push(make_pair(make_pair(x+1,y+1),z+1));
	if(a[y][x+1]==0&&b[y][x+1])
	  c.push(make_pair(make_pair(x+1,y),z+1));
	if(a[y-1][x]==0&&b[y-1][x])
	  c.push(make_pair(make_pair(x,y-1),z+1));
	if(a[y-1][x-1]==0&&b[y-1][x-1])
	  c.push(make_pair(make_pair(x-1,y-1),z+1));
	if(a[y][x-1]==0&&b[y][x-1])
	  c.push(make_pair(make_pair(x-1,y),z+1));
	if(a[y+1][x]==0&&b[y+1][x])
	  c.push(make_pair(make_pair(x,y+1),z+1));
      }
    }
    cout<<ct<<endl;
  }
  return 0;
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long N;
    cin >> N;
    
    cout << N*(N-1)/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int a, b;
	cin >> a >> b;
	if ((ll)a*b <= 0) {
		cout << "Zero"<<endl;
	}
	else if(a>0){
		cout << "Positive" << endl;
	}
	else if(b<0){
		if ((a*(-1) - b*(-1)) % 2==0) {
			cout << "Negative" << endl;
		}
		else {
			cout << "Positive" << endl;
		}
	}

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll a[10][10],b[10]={0},c[10]={0},d[10];
ll m,n,k,cnt=0;
void solve3(ll i,ll ss){
	if(i==n){
		if(ss==k)
			cnt++;
		return;
	}
	if(ss-c[i]>=k){
		solve3(i+1,ss-c[i]);
		solve3(i+1,ss);
	}
	else
		solve3(i+1,ss);
}
void solve2(ll k,ll sss){
	ll i,j,z,s;
	if(k!=0)
		for(i=0;i<n;i++){
			s=0;
			for(j=0,z=0;j<m;j++){
				if(z<k&&j==d[z]){
					z++;
					continue;
				}
				if(a[j][i]=='#')
					s++;
			}
			c[i]=s;
		}
	else
		for(i=0;i<n;i++){
			s=0;
			for(j=0;j<m;j++){
				if(a[j][i]=='#')
					s++;
			}
			c[i]=s;
		}
	solve3(0,sss);
//	for(i=0;i<k;i++)
//		cout<<d[i]<<" ";
//	cout<<endl;
//	for(i=0;i<n;i++)
//		cout<<c[i]<<" ";
//	cout<<endl<<endl;
	return;
}
void solve(ll i,ll j,ll ss){
	if(i==m){
		solve2(j,ss);
		return;
	}
	if(ss-b[i]>=k){
		d[j]=i;
		solve(i+1,j+1,ss-b[i]);
		solve(i+1,j,ss);
	}
	else
		solve(i+1,j,ss);
}

int main(){
	scanf("%lld%lld%lld",&m,&n,&k);
	ll i,j,s=0;
	for(i=0;i<m;i++){
		getchar();
		for(j=0;j<n;j++){
			scanf("%c",&a[i][j]);
			if(a[i][j]=='#'){
				s++;
				b[i]++;
			}
		}
	}
	if(s<k)
		cout<<"0";
	else{
		solve(0,0,s);
		cout<<cnt<<endl;
	}
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=200010;
const int P=1000000007;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
	int a,b,c,d,k;
	cin>>a>>b>>c>>d>>k;



	cout<<      c*60+d-a*60-b-k  <<endl;


}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
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 vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
const int MOD = 1000000007;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
   int n;cin>>n;
   string S;cin>>S;
   int Q;cin>>Q;
   vector<set<int> > pls(26);

   rep(i,n){
      pls[S[i]-'a'].insert(i);
   }
   rep(i,Q){
      int t;
      cin>>t;
      if(t==1){
         int itr;
         char c;
         cin>>itr>>c;
         itr--;
         char pc=S[itr];
         S[itr]=c;
         pls[pc-'a'].erase(itr);
         pls[c-'a'].insert(itr);
      }
      else{
         int l,r;
         cin>>l>>r;
         l--;
         int res=0;
         rep(c,26){
            auto it=pls[c].lower_bound(l);
            if(it!=pls[c].end() && *it<r)res++;
         }
      cout<<res<<endl;
      }
      }
   }


Measured memory_bytes: 27208
#include <bits/stdc++.h>
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%I64d",&x)
#define SF2(x,y) scanf("%I64d%I64d",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()
using namespace std;
const long long INF = 1e9+5e8;
long long MOD = 1e9+7;
long double eps = 1e-15;
ll f(ll x){
    if(x<=1)R 1;
    R (x*f(x-1))%MOD;
}
int main(){
    ll n,m;
    cin>>n>>m;
    if(abs(n-m)>1)cout<<0;
    else{
        if(n==m)cout<<(f(n)*f(m)*2)%MOD;
        else cout<<(f(n)*f(m))%MOD;
    }
}


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

now = [0,0]
time = 0

for i in range(n):
    t,x,y = lst[i][0], lst[i][1], lst[i][2]
    distance = abs(now[0]-x) + abs(now[1]-y)
    if (t - time) % 2 == 0 and distance % 2 == 0 and (t - time) >= distance:
        now = [x,y]
        time = t
    elif (t - time) % 2 != 0 and distance % 2 != 0 and (t - time) >= distance:
        now = [x,y]
        time = t
    else:
        print('No')
        exit()
print('Yes')

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


int main(){
  int n;
  cin >> n;
  vector<int> xi(n);
  vector<int> yi(n);
  double ans = 0;
  rep(i, n){
    cin >> xi[i] >> yi[i];
    for(int j = 0; j < i; j++){
      ans += (sqrt(pow((xi[i]-xi[j]),2) + pow((yi[i]-yi[j]),2)) * 2)/ n;
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    N, D = map( int, input().split())
    XY = [ tuple( map(int, input().split())) for _ in range(N)]
    ans = 0
    d = D**2
    for x,y in XY:
        if x**2 + y**2 <= d:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 35992