akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ls ((rt) << 1)
#define rs ((rt) << 1 | 1)
#define mp(a, b) make_pair(a, b)
#define lowbit(x) ((x) & -(x))
typedef pair<int, int> pii;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 10;
int s[maxn], c[maxn];
int n, m;
bool check(int x)
{
	for(int i = 1; i <= m; ++i)
	{
		int tmp = x;
		for(int j = s[i] + 1; j <= n; ++j) tmp /= 10;
		if(tmp % 10 != c[i]) return false;	
	}
	return true;
}
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= m; ++i)
		cin >> s[i] >> c[i];
	int lim = 1;
	for(int i = 1; i <= n; ++i) lim *= 10;
	for(int i = n == 1 ? 0 : lim / 10; i < lim; ++i)
		if(check(i))
		{
			cout << i << endl;
			return 0;
		}
	puts("-1");
	return 0;
}

Measured memory_bytes: 256
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;  
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n) {
	for (int i = 0; i < n; ++i)
		cout << arr[i] << ' ';
	cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) {
	ll ans = 1;
	while (n) {
		if (n&1) ans = (ans*a)%modulo;
		a = (a*a)%modulo; n = n >> 1;
	}
	return ans;
}

void solve() {
	string s;
	cin >> s;
	int n = s.size();
	ll cnt[2019] = {0};
	++cnt[0];
	int curr = 0, power = 1;
	for (int i = n-1; i >= 0; --i) {
		curr = (power * (s[i]-'0') + curr)%2019;
		power = (power * 10)%2019;
		++cnt[curr];
	}	
	ll ans = 0;
	for (int i = 0; i < 2019; ++i) {
		if (cnt[i]) {
			ans += (cnt[i] * (cnt[i]-1))/2;
		}
	}
	cout << ans << endl;
}

int main() {
	fast_io();
	int t = 1;
	// cin >> t;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    while(1){
        ll b[n] = {};
        ll sum = 0;
        for(ll i = 0; i < n; i++){
            if(a[i] > n - 1) b[i] = (a[i] - (n - 1)) / n + !!((a[i] - (n - 1)) % n);
            sum += b[i];
        }
        if(!sum) break;
        for(ll i = 0; i < n; i++) a[i] = a[i] - b[i] * n + (sum - b[i]);
        ans += sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int max = 0;
		for (int i = 1; (long)i * i <= n; i++) {
			max = Math.max(max, i * i);
		}

		pr.println(max);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 24788
// Problem : C - pushpush
// Contest : AtCoder - AtCoder Beginner Contest 066
// URL : https://atcoder.jp/contests/abc066/tasks/arc077_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int n;cin>>n;
deque<int> d;
for(int i=0;i<n;i++)
{
	int x;cin>>x;
	if(i&1)
	d.push_back(x);
	else
	d.push_front(x);
}
if(n%2==0)
{
	for(auto it=d.rbegin();it!=d.rend();it++)
	cout<<*it<<" ";
}
else
for(int i:d)
cout<<i<<" ";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 5276
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,mx=0;
    cin>>n;
    map<string,ll> mp;
    string s;
    rep(i,n){
        cin>>s;
        mp[s]++;
        mx=max(mx,mp[s]);
    } 
    for(auto x:mp){
        if(x.second==mx) cout<<x.first<<endl;
    }
    return 0;
}

Measured memory_bytes: 25216
N = int(input())
pp = list(map(int, input().split(" ")))

count = 0

i = 1
while i < N - 1:
    if pp[i - 1] < pp[i] < pp[i + 1] or pp[i - 1] > pp[i] > pp[i + 1]:
        count += 1
    i += 1

print(count)


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath> 

using namespace std;

const long long inf = 0x7fffffffffffffffll;

struct node
{
	long long r,b;
}bag[200100];

long long n;
long long ans = inf,rmax,rmin = inf,bmax,bmin = inf;
long long mi[200100],ma[200100];

bool cmp(node a,node b)
{
	return a.b < b.b;
}

int main()
{
	// freopen("c.in","r",stdin);
	// freopen("c.out","w",stdout);
	scanf("%lld",&n);
	for(int i = 1;i <= n;i++)
	{
		long long a,b;
		scanf("%lld%lld",&a,&b);
		bag[i].r = max(a, b);
		bag[i].b = min(a, b);
		rmax = max(bag[i].r,rmax);
		rmin = min(bag[i].r,rmin);
		bmax = max(bag[i].b,bmax);
		bmin = min(bag[i].b,bmin);
	}
	ans = (rmax - rmin) * (bmax - bmin);
	sort(bag + 1,bag + 1 + n,cmp);
	if(rmin > bmax)
	{
		printf("%lld\n",ans);
		return 0;
	}
	ma[1] = bag[1].r;mi[1] = bag[1].r;
	for(int i = 2;i <= n;i++)
		ma[i] = max(ma[i - 1],bag[i].r),
		mi[i] = min(mi[i - 1],bag[i].r);
	int tmp = 1;
	rmin = bmin;
	bmax = max(bag[1].r,bmax);
	bmin = min(bag[2].b,bag[1].r);
	for(int i = 2;i <= n;i++)
	{
		ans = min(ans,(bmax - bmin) * (rmax - rmin));
		bmax = max(bmax,ma[i]);
		bmin = min(bag[i + 1].b,mi[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define ll long long
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define MAX 1e9
#define MIN -1e9
#define MOD 1000000007

int main(){
	ios::sync_with_stdio(0); 
    cin.tie(0); 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	set<int> st;
	int n, x;
	cin >> x >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
		st.insert(a[i]);
	}
	int ans = MIN;
	int i = 0;
	while(true){
		if(st.count(x-i) == 0)
			ans = x - i;
		else if(st.count(x + i) == 0)
			ans = x + i;
		else if(st.count(x - i) == 0)
			ans = x - i;
		if(ans != MIN){
			cout << ans << "\n";
			return 0;
		}
		i++;
	}
	return 0;
}

Measured memory_bytes: 3664
import sys
n,q=map(int,input().split())
s=input()
c=[0]*n
for i in range(2,n+1):
  if s[i-2:i]=='AC':
    c[i-1]=c[i-2]+1
  else:
    c[i-1]=c[i-2]
lr=sys.stdin.readlines()
for i in lr:
  l,r=map(int,i.split())
  print(c[r-1]-c[l-1])

Measured memory_bytes: 13476
#include <iostream>
#include <queue>
#include <map>

using namespace std;

//HEX移動用の差分
int xd[6]={0,1,1,0,-1,-1};
int yd[6]={1,1,0,-1,-1,0};

bool mapAc(map<int,map<int,bool> > &mp, int x,int y){
	if(mp.find(x)!=mp.end()){
		if(mp[x].find(y)!=mp[x].end()){
			return true;
		}
	}
	return false;
}
int solve(int x,int y,int depth,map<int,map<int,bool> > &mp){

	map<int,map<int,bool> > flgg;

	int cnt=0;
	queue<pair<int,pair<int,int> > > q;
	q.push(pair<int,pair<int,int> >(x,pair<int,int>(y,depth)));

	while(!q.empty()){
		int cx,cy,cd;
		pair<int,pair<int,int> > frt = q.front();
		q.pop();
		cx=frt.first;
		cy=frt.second.first;
		cd=frt.second.second;
		if(!mapAc(flgg,cx,cy)){
			if(cd>0){
				for(int i=0;i<6;i++){
					int nnx = cx+xd[i];
					int nny = cy+yd[i];
					int nnd = cd-1;
					if(!mapAc(mp,nnx,nny) && !mapAc(flgg,nnx,nny))
						q.push(pair<int,pair<int,int> >(nnx,pair<int,int>(nny,nnd)));
				}
			}
			flgg[cx][cy]=true;
			cnt++;
		}
	}

	return cnt;
}

int main ( void ){
	while(1){
		int t,n;
		int x,y;
		//t,nの入力
		cin >> t;
		cin >> n;
		//ターミナル処理
		if(t==0 && n==0) break;

		map<int,map<int,bool> > mpp;
		//障害物の入力
		for(int i=0;i<n;i++){
			cin >> x;
			cin >> y;
			mpp[x][y]=true;
		}
		//始点の入力
		cin >> x;
		cin >> y;
		//実行・解の表示
		cout << solve(x,y,t,mpp) << endl;
	}
}

Measured memory_bytes: 1380
//Vivek
#pragma optimize("", off)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:36777216")
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long 
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
#define sz(i) int(i.size())
#define setto(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define mem(a, b) memset(a, b, sizeof(a))
#define len(s) int(s.length())
#define INF LONG_MAX
#define UNIQUE(a) ((a).erase(unique((a).begin(), (a).end()), (a).end()))
#define random() ((ll)rand() << 32 | rand())
#define C(c) c-'a'

using namespace std;

#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}
template<class T> void smax(T& a, T val) {if (a < val) a = val;}
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
//Check N size twiceeeeeeeeeeeeeeeeee, and verify it
const int N = 2*1e5 + 10;

int n, a[N];
int main(){
	boost;

	cin>>n;
	
	ll x = __gcd(2, n);

	ll ans = (2LL*n)/x;	

	cout<<ans;

	return 0;
}


Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cassert>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    int n;
    cin>>n;

    if(n==1)cout<<0<<endl;
    else cout<<1<<endl;
}

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

typedef long long ll;
typedef int ii;
typedef vector<int> vi;

#define T while(t--)
#define for1(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
//#define mp make_pair

ii main()
{
    ii a,b;
    
    cin>>a>>b;
    
    cout<<a*b<<"\n";
    
}


Measured memory_bytes: 3592
#include <iostream>

#include <string>

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

using std::string;

static bool
check_j(int c[3][3], int a, int b)
{
  int diff = c[0][a] - c[0][b];
  return (c[1][a] - c[1][b] == diff && c[2][a] - c[2][b] == diff);
}

static bool
check_i(int c[3][3], int a, int b)
{
  int diff = c[a][0] - c[b][0];
  return (c[a][1] - c[b][1] == diff && c[a][2] - c[b][2] == diff);
}

static string
solve(int c[3][3])
{
  return ((check_j(c, 0, 1) && check_j(c, 1, 2) && check_i(c, 0, 1) && check_i(c, 1, 2))
          ? "Yes" : "No");
}

int
main()
{
  int c[3][3];
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> c[i][j];
    }
  }
  cout << solve(c) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  
  long sum = 0;
  int i = 1;
  while (i <= n)
  {
    if (!(i % 3 == 0 || i % 5 == 0))
    {
      sum += i;
    }
    i++;
  }
  printf("%ld", sum);
  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <queue>
using namespace std;

int dx[10]={1,-1,0,0,1,-1,1,-1},dy[10]={0,0,1,-1,1,-1,-1,1},n,m;
char mp[110][110];

char cal(int x,int y)
{
	int num=0;
	for(int i=0;i<8;i++)
	{
		if(mp[x+dx[i]][y+dy[i]]=='#')
		num++;
	}
	return num+'0';
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",mp[i]+1);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(mp[i][j]=='.')
			{
				mp[i][j]=cal(i,j);
			}
		} 
	}
	for(int i=1;i<=n;i++)
	{
		printf("%s\n",mp[i]+1);
	 } 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char s[250];
int main ()
{

	while(scanf("%s",s)!=EOF)
	{
		int i,len,n;
		len=strlen(s);
		n=len/2-1;
		while(n)
		{
			int k=0;
			for(i=0;i<n;i++)
				if(s[i]!=s[i+n])
					k++;
			n--;
			if(k==0){
				printf("%d\n",n*2+2);	
				break;
			}		
		}
	}
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a[200010];
long long h[200010];
int main()
{
	int n,i,x;
	long long ans=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		h[a[i]]++;
	}
	for(i=1;i<=n;i++)
		ans+=h[i]*(h[i]-1)/2;
	for(i=1;i<=n;i++)
		cout<<ans-h[a[i]]+1<<endl;
	return 0;
}

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

int main(void) {
	long long a,b,c,d,max,num[4];
	max = 0;

	cin >> a >> b >> c >> d;

	num[0] = a*c;
	num[1] = b*c;
	num[2] = a*d;
	num[3] = b*d;

	for (int i = 0;i < 4;i++) {
		if (i == 0) {
			max = num[i];
		}
		else if (max < num[i]) {
			max = num[i];
		}
	}

	cout << max << endl;
}

Measured memory_bytes: 3632
from itertools import permutations
import gc
def read(): return list(map(int, input().split()))
 
 
INF = 114514810
 
 
def wf(d):
    N = len(d[0])
    for k in range(N):
        for i in range(N):
            for j in range(N):
                D = d[i][k] + d[k][j]
                if d[i][j] > D:
                    d[i][j] = D
    return d
 
 
def calc_dist(p, d):
    dist = 0
    for i in range(len(p) - 1):
        if d[p[i]][p[i + 1]] >= INF:
            return INF
        dist += d[p[i]][p[i + 1]]
    return dist
 
 
def main():
    N, M, R = read()
    r = map(lambda x: x - 1, sorted(read()))
    d = [[INF for i in range(N)] for j in range(N)]
 
    for i in range(M):
        a, b, c, = read()
        a -= 1
        b -= 1
        d[a][b] = d[b][a] = c
 
    d = wf(d)
 
    min_dist = INF
    for p in list(permutations(r)):
        min_dist = min(min_dist, calc_dist(p, d))
 
    print(min_dist)
 
 
if __name__ == '__main__':
    gc.disable()
    main()

Measured memory_bytes: 9680
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

def ns(X, n):
    if (int(X/n)):
        return ns(int(X/n), n)+str(X%n)
    return str(X%n)

n,a,b,c=map(int,input().split())
t=[a,b,c]
l=[]
ans=-1
for i in range(n):
    l.append(int(input()))

for i in range(4**n):
    tmp=ns(i,4)
    tmp="0"*(n-len(tmp))+tmp
    h=[0]*3
    p=0
    for j in range(n):
        if tmp[j]=="1":
            if h[0]!=0: p+=10
            h[0]+=l[j]

        elif tmp[j]=="2":
            if h[1]!=0: p+=10
            h[1]+=l[j]

        elif tmp[j]=="3":
            if h[2]!=0: p+=10
            h[2]+=l[j]

    if 0 in h:continue
    for k in range(3):
        p+=abs(h[k]-t[k])
    if ans==-1: ans=p
    else: ans=min(ans,p)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
using namespace std;

#define _USE_MATH_DEFINES
#include <math.h>


int main()
{
	double nA;
	cin >> nA;
	double dA, dC;
	dA = M_PI*nA*nA;
	dC = 2 * M_PI*nA;

	printf("%.6f %.6f\n", dA, dC);

	//system("pause");
	return 0;
}

Measured memory_bytes: 3148
while(True):
    try:
        s = raw_input()
        for i in range(26):
            for j in range(len(s)):
                if('a' <= s[j] <= 'y'):
                    s = s[0:j:] + chr(ord(s[j]) + 1) + s[j + 1::]
                elif(s[j] == 'z'):
                    s = s[0:j:] + 'a' + s[j + 1::]
            if("this" in s or "that" in s or "the" in s):
                print(s)
    except Exception:
        break

Measured memory_bytes: 4224
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;  typedef long long ll;
inline int qr(){
	int ret=0,f=0,c=getchar();
	while(!isdigit(c))f|=c==45,c=getchar();
	while(isdigit(c)) ret=ret*10+c-48,c=getchar();
	return f?-ret:ret;
}
const int maxn=3e5+5;
int seg[maxn],n,m;
void add(int pos,int val){
	++pos;
	for(int t=pos;t<=m+1;t+=t&-t) seg[t]+=val;
}
int que(int pos){
	++pos;
	int ret=0;
	for(int t=pos;t>0;t-=t&-t) ret+=seg[t];
	return ret;	
}
struct LINE{
	int l,r,len;
	bool operator < (LINE a)const{return len<a.len;}
}data[maxn];

void print(int d,int f){
	int ret=0;
	for(int i=0;i<=m;i+=d)
		ret+=que(i);
	printf("%d\n",ret+f);
}

int main(){
	n=qr(); m=qr();
	for(int t=1,l,r;t<=n;++t) l=qr(),r=qr(),data[t]={l,r,r-l+1};
	sort(data+1,data+n+1);
	for(int t=1,p=0;t<=m;++t){
		while(p<n&&data[p+1].len<=t) ++p,add(data[p].l,1),add(data[p].r+1,-1);
		print(t,n-p);
	}
	return 0;
}



Measured memory_bytes: 4992
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,sum;
        sum = 0;
        x = scan.nextLine();
        x = x.toLowerCase();
        while(true){
            str = scan.nextLine();
            if(str.equals("END_OF_TEXT")){
                break;
            }
            str = str.toLowerCase();
            String[] words = str.split(" ", 0);
            for(i=0;i<words.length;i++){
                if(x.equals(words[i])){
                    sum++;
                }
            }
        }
        System.out.println(sum);

        scan.close();

    }

}



Measured memory_bytes: 26408
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int number[10];
int table[15][15];

bool check(int x)
{
	for (int i = 4; i >= 1; --i)
		number[i] = x % 10, x /= 10;

	number[5] = 0;	// check number

	for (int i = 1; i <= 4; ++i)
		number[5] = table[number[5]][number[i]];

	/*
	cout << "number" << endl;
	for (int i = 1; i <= 5; ++i)
		cout << number[i] << " ";
	cout << endl;
	*/

	//	error1

	for (int i = 1; i <= 5; ++i)
		for (int j = 0; j < 10; ++j)
			if (j != number[i])
			{
				int tmp = 0;

				for (int k = 1; k <= 5; ++k)
				{
					if (k == i)
						tmp = table[tmp][j];
					else
						tmp = table[tmp][number[k]];
				}

				if (!tmp)return true;
			}

	//	error2

	for (int i = 1, j = 2; i <= 4; ++i, ++j)
		if (number[i] != number[j])
		{
			int tmp = 0;

			for (int k = 1; k <= 5; ++k)
			{
				if (k == i)
					tmp = table[tmp][number[j]];
				else if (k == j)
					tmp = table[tmp][number[i]];
				else
					tmp = table[tmp][number[k]];
			}

			if (!tmp)return true;
		}

	return false;
}

signed main(void)
{
	for (int i = 0; i < 10; ++i)
		for (int j = 0; j < 10; ++j)
			cin >> table[i][j];

	int answer = 0;

	for (int i = 0; i < 10000; ++i)
		if (check(i))++answer;

	cout << answer << endl;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e12;
const int MOD = 1e9 + 7;
#define MAX_N 110
#define MAX_V 100100

ll dp[MAX_N][MAX_V];

int main(){
	int N;
	ll W;
	cin >> N >> W;
	ll w[N],v[N];
	REP(i,N) cin >> w[i] >> v[i];
	REP(i,MAX_N) REP(j,MAX_V) dp[i][j] = INF;
	dp[0][0] = 0;
	REP(i,N){
		for(int sum_v = 0; sum_v < MAX_V; sum_v++){
			if(sum_v - v[i] >= 0) dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i]);
			dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v]);
		}
	}
	ll ans = 0;
	for(int sum_v = 0; sum_v < MAX_V; sum_v++){
		if(dp[N][sum_v] <= W) ans = sum_v;
	}
	cout << ans << endl;
}

Measured memory_bytes: 86400
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;
int main(){
  int N,C,K;
  cin>>N>>C>>K;
  vector<int>T(N);
  for(int i=0;i<N;i++){
    cin>>T[i];
  }
  sort(T.begin(),T.end());
  int bus=0;
  for(int i=0;i<N;){
    bus++;
    int k=i;
    while(T[i]-T[k]<=K&&i-k<C){i++;}
  }
  cout<<bus<<endl;
  return 0;
  }

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

int main() {
  long long n,m,sum=0, mod=2019;
  cin>>n>>m;
  if(n%(2*m+1)==0)
  cout<<n/(2*m+1)<<endl;
  else
    cout<<n/(2*m+1)+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if(a + b >= c && c >= a) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 3532
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

#define LL long long
#define N 1000010
#define M 1010

using namespace std;

struct Edge {
    int from, to; 
}e[N]; 

int n,num,cnt,tot,ans;
int head[N],a[M][M],node[M][M];
int inq[N],t[N],day[N]; 

inline void add_edge(int x,int y) {
    e[++cnt].from = y;
    e[cnt].to = head[x];
    head[x] = cnt;
}
void topsort() {
    for(int i = 1; i <= tot; i++) {
        int u = t[i]; 
        for(int j = head[u]; j; j = e[j].to) {
            int v = e[j].from; 
            day[v] = day[u] + 1; 
            inq[v]--; 
            if(!inq[v])t[++tot] = v; 
        }
    }
    for(int i = 1; i <= num; i++)
        ans = max(ans, day[i]); 
}

int main() {
    scanf("%d",&n); 
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j < n; j++) {
            scanf("%d",&a[i][j]); 
            if(!node[i][j] && !node[j][i])
                node[i][j] = node[j][i] = ++num; 
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 2; j < n; j++) {
            add_edge(node[i][a[i][j-1]], node[i][a[i][j]]); 
            inq[node[i][a[i][j]]]++; 
        }
    }
    for(int i = 1; i <= num; i++) {
        if(!inq[i]) {
            t[++tot] = i; 
            day[i] = 1; 
        }
    }
    topsort(); 
    if(tot != num) puts("-1"); 
    else printf("%d\n", ans); 
    return 0; 
}

Measured memory_bytes: 31616
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll H; cin >> H;
  ll ans = 0LL;
  for(ll i = pow(2, 60); i >= 1; i/=2) {
    if(H/i > 0) ans += i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>

using namespace std;

int main(){
  int h,w,d,q;
  cin >> h >> w >> d;
  int dis[90001] = {0};
  int x[90001]; int y[90001];
  for(int i = 0; i < h ; i++){
    for(int j = 0 ; j < w ; j++){
      int a; cin >> a;
      x[a] = i; y[a] = j;
    }
  }
  cin >> q;
  int l[100000];
  int r[100000];
  for(int i = 0 ; i < q; i++){
    cin >> l[i] >> r[i];
  }

  for(int i = d; i <= h * w ; i++){
      dis[i] = dis[i - d] + abs(x[i] - x[i - d]) + abs(y[i] - y[i - d]);
  }
  for(int i = 0 ; i < q; i++){
      cout << dis[r[i]] - dis[l[i]] << endl;
  }
}


Measured memory_bytes: 2944
#include<stdio.h>
#include<map>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<utility>
#include<string.h>
#include<string>
#define n 200000
#define loop(i, a, b) for(int i=a; i<=b; i++)
using namespace std;
typedef pair<int, int> P;
typedef long long lli;
typedef double llf;
bool visit[n + 50];
int arr[n + 50], arr2[n + 50], a, b, c, d, e, f;
string str1, str2;
struct edge{
	int from, to, weight;
	bool operator < (const edge& thing) const
	{
		return thing.weight < weight;
	}
};
vector<edge> V[n + 50];
void addedge(int a, int b, int c)
{
	edge temp;
	temp.from = a;
	temp.to = b;
	temp.weight = c;
}

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

void solve()
{
	cin >> a;
	cout << a * a * a;
}
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 0, times - 1)
	{
		solve();
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 6400
from collections import deque
def bfs(k):
    lunlun = []
    q = deque()
    count = 0
    for i in range(1, 10):
        lunlun.append(i)
        q.append(i)
        count += 1

    if count >= k:return lunlun[k - 1]

    while True:
        num = q.popleft()
        tail = num % 10
        for i in [-1, 0, 1]:
            temp = tail + i
            if temp == -1 or temp == 10:continue
            q.append(num * 10 + temp)
            lunlun.append(num * 10 + temp)
            count += 1
            if k == count:return lunlun[k - 1]

k = int(input())
print(bfs(k))


Measured memory_bytes: 16812
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int min = Math.max(x + y - n, 0);
		int max = Math.min(x, y);
		System.out.println(max + " " + min);
	}
}


Measured memory_bytes: 21844
import Control.Monad
import Data.List

type Region = (Int, Int, Int, Int)

main = do
  n <- liftM read getLine
  replicateM n analyze

analyze = do
  [h, w] <- liftM (map read . words) getLine
  image <- getImage h w
  let tiles = nub $ concat $ image
  let loops = any (\a -> overlayLoops image tiles a []) tiles
  putStrLn $ if loops then "SUSPICIOUS" else "SAFE"

overlayLoops image tiles a visited =
  any (\b -> b `elem` visited || overlayLoops image tiles b (b:visited)) $ filter (\b -> overlays image b a) $ filter ((/=) a) tiles

-- a overlays b
overlays :: [[Char]] -> Char -> Char -> Bool
overlays image a b =
  let y0 = minimum $ findIndices (elem b) image
      y1 = maximum $ findIndices (elem b) image
      x0 = minimum $ concatMap (elemIndices b) image
      x1 = maximum $ concatMap (elemIndices b) image
  in a `elem` [ image !! y !! x | y <- [y0..y1], x <- [x0..x1] ]

getImage h w = do
  replicateM h getLine

Measured memory_bytes: 5524
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    int N,K;cin>>N>>K;
    int info[N];
    rep(i,N)cin>>info[i];
    int ans=0,now;
    rep(i,min(N,K)+1){
        rep(j,min(N,K)-i+1){
            int A=i,B=j,C=K-i-j;
            now=0;
            priority_queue<int,vector<int>,greater<int>> have;
            rep(k,A)have.push(info[k]);
            rep(k,B)have.push(info[N-1-k]);
            rep(k,C){
                if(have.size()==0)break;
                if(have.top()<0)have.pop();
                else break;
            }
            while(have.size()){
                now+=have.top();
                have.pop();
            }
            ans=max(ans,now);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
t = input()

len_s = len(s)
len_t = len(t)

# LCSの最長を求める
dp = [[0] * (len_t+1) for _ in range(len_s + 1)]
for i in range(len_s):
    for j in range(len_t):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

# DPを後ろから遡っていって、LCSを求める
lcs_str = ''
i, j = len_s-1, len_t-1
while i >= 0 and j >= 0:
    if s[i] == t[j]:
        lcs_str += s[i]
        i -= 1
        j -= 1
    else:
        if dp[i][j+1] > dp[i+1][j]:
            i -= 1
        else:
            j -= 1
print(lcs_str[::-1])


Measured memory_bytes: 112220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vll = vector<ll>;
#define _GLIBCXX_DEBUG

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

const ll INF = INT64_MAX - 5;

int main()
{
    ll n, k;
    cin >> n >> k;
    vll pos, neg, zer;
    rep(i, n)
    {
        ll a;
        cin >> a;
        if (a == 0)
        {
            zer.emplace_back(a);
        }
        else if (a > 0)
        {
            pos.emplace_back(a);
        }
        else
        {
            neg.emplace_back(abs(a));
        }
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    auto cnt = [&](ll x) {
        ll now = 0;
        if (x == 0)
        {
            now = neg.size() * pos.size();
            return now;
        }
        if (x > 0)
        {

            rep(i, pos.size())
            {
                // (a,b]
                ll fd = (x - 1) / pos[i];
                int idx = upper_bound(pos.begin(), pos.end(), fd) - pos.begin();
                if (idx > i)
                    idx--;
                now += max(0, idx);
            }
            rep(i, neg.size())
            {
                ll fd = (x - 1) / neg[i];
                int idx = upper_bound(neg.begin(), neg.end(), fd) - neg.begin();
                if (idx > i)
                    idx--;
                now += max(0, idx);
            }
            now /= 2;

            now += neg.size() * pos.size();
            now += zer.size() * (pos.size() + neg.size());
            now += (zer.size() * (zer.size() - 1)) / 2;

            return now;
        }
        // x < 0
        x = abs(x);
        rep(i, pos.size())
        {
            ll fd = (x) / pos[i];
            int idx = upper_bound(neg.begin(), neg.end(), fd) - neg.begin();
            now += neg.size() - idx;
        }
        return now;
    };

    ll l = -INF, r = INF;
    while (l < r)
    {
        ll mid = (l + r + 1) / 2;
        ll c = cnt(mid);
        // printf("%ld %ld: %ld %ld\n", l, r, mid, c);
        bool ok = c < k;
        if (ok)
        {
            l = mid;
        }
        else
        {
            r = mid - 1;
        }
    }

    printf("%ld\n", l);

    return 0;
}

Measured memory_bytes: 5432
#include <iostream>
#include <vector>
#include <set>
int main()
{
  int H, W;
  std::cin >> H >> W;
  std::vector<std::vector<char> > A(H, std::vector<char>(W));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++) std::cin >> A.at(i).at(j);
  }
  std::set<int> deleteH, deleteW;
  bool is_all_blank;
  for (int i = 0; i < H; i++)
  {
    is_all_blank = true;
    for (int j = 0; j < W; j++)
    {
      if (A.at(i).at(j) == '#')
      {
        is_all_blank = false;
        break;
      }
    }
    if (is_all_blank) deleteH.insert(i);
  }
  for (int i = 0; i < W; i++)
  {
    is_all_blank = true;
    for (int j = 0; j < H; j++)
    {
      if (A.at(j).at(i) == '#')
      {
        is_all_blank = false;
        break;
      }
    }
    if (is_all_blank) deleteW.insert(i);
  }
  for (int i = 0; i < H; i++)
  {
    if (deleteH.find(i) != deleteH.end()) continue;
    for (int j = 0; j < W; j++)
    {
      if (deleteW.find(j) != deleteW.end()) continue;
      std::cout << A.at(i).at(j);
    }
    std::cout << std::endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
ll mem[1000000]={0};
ll mem2[1000000]={0};
int main(){
	string str="";
	bool f = false;
	int ma = 0;
	while(getline(cin,str)){
		int x;
		stringstream s(str);
		s >> x;
		if(str == "")f = true;
		else if(!f)mem[x]++;
		else if(f && mem[x] > 0){
			mem2[x]++;
			ma = max(ma,x);
		}
	}
	rep(i,ma+1){
		if(mem2[i] > 0)printf("%d %d\n",i,mem[i]+mem2[i]);
	}
	return 0;
}

Measured memory_bytes: 3288
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = []
n = inp()
a = inpl()
aa = set(a)
aa = sorted(list(aa),reverse=True)
# print(a,aa)
d = defaultdict(int)

for key in a:
    d[key] += 1
for i in aa:
    if d[i] >= 4:
        if ans == []:
            print(i**2)
            quit()
    if d[i] >= 2:
        ans.append(i)
        if len(ans) == 2:
            print(ans[0]*ans[1])
            quit()
print(0)

Measured memory_bytes: 21528
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

ll dp[50][2];
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   int n;
   ll k;
   cin >> n >> k;
   vector<ll> a(n);
   rep(i, 0, n) cin >> a[i];
   rep(i, 0, 50) dp[i][0] = dp[i][1] = -1;

   dp[45][0] = 0;
   rrep(d, 44, 0) {
      ll bitk = 1LL << d;

      int cnt = 0;
      rep(i, 0, n) if (a[i] & bitk) cnt++;
      if (dp[d + 1][1] >= 0) {
         chmax(dp[d][1], dp[d + 1][1] + bitk * max(cnt, n - cnt));
      }

      if (dp[d + 1][0] >= 0) {
         if (bitk & k) {
            chmax(dp[d][1], dp[d + 1][0] + bitk * cnt);
            chmax(dp[d][0], dp[d + 1][0] + bitk * (n - cnt));

         } else {
            chmax(dp[d][0], dp[d + 1][0] + bitk * cnt);
         }
      }
   }
   cout << max(dp[0][0], dp[0][1]) << endl;
   return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	for {
		var n, x, cnt int
		fmt.Scan(&n, &x)
		if n == 0 {
			break
		}
		for i := 1; i <= n; i++ {
			for j := i + 1; j <= n; j++ {
				for k := j + 1; k <= n; k++ {
					if i+j+k == x {
						cnt++
					}
				}
			}
		}
		fmt.Println(cnt)
	}
}



Measured memory_bytes: 1092
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int x=1,y=1,a,b,ans=1;
	cin>>a>>b;
	ans=a-1;
	if(b>=a) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  string s;
  cin >> s;
  int n = s.size();
  vi a(n);
  rep2(i,1,n){
    i--;
    int p = i;
    while(s[i]=='R'){
      i++;
      if(s[i]=='L'){
        int aa = 0;
        if((i-p)%2==1) aa++;
        a[i-1] += (i-p)/2+aa;
        a[i] += (i-p)/2;
      }
    }
    int q = i;
    while(s[i]=='L'){
      i++;
      if(s[i]=='R' || i==n-1){
        int bb = 0;
        if((i-q)%2==1) bb++;
        a[q-1] += (i-q)/2;
        a[q] += (i-q)/2+bb;
      }
      if(i==n-1 || i==n) {
        //cout << "p" << endl;
        if((min(i,n-1)-q)%2==1) a[q-1]++;
        else a[q]++;
        break;
      }
    }
  }
  rep(i,n) cout << a[i] << endl;
      
}


Measured memory_bytes: 1024
from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

N, M, L = list(map(int, input().split()))

A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i in range(M):
	Ai, Bi, Ci = list(map(int, input().split()))
	A[i] = Ai - 1
	B[i] = Bi - 1
	C[i] = Ci

graph = csr_matrix((C, (A, B)), shape=(N, N))
#print(graph)
dist = floyd_warshall(graph, directed=False)

graph2 = np.full((N, N), np.inf)
graph2[dist <= L] = 1
graph2 = csr_matrix(graph2)
num = floyd_warshall(graph2, directed=False)


num = num.tolist()

Q = int(input())
for q in range(Q):
	s, t = list(map(int, input().split()))
	if num[s - 1][t - 1] < 10000000:
		print(int(num[s - 1][t - 1] - 1))
	else:
		print(-1)

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

int main() {
  string nu;
  char ch[4];
  cin >> nu;
  int a, b, c, d, sum = 0;
  a = (int)nu[0] - '0';
  b = (int)nu[1] - '0';
  c = (int)nu[2] - '0';
  d = (int)nu[3] - '0';
  int fun[3] = {0};
  sum = 0;
  sum += a;

  for (int j = 0; j < 2; j++) {

    if (j == 0) {
      sum += b;
      ch[1] = '+';
    } else {
      sum -= b;
      ch[1] = '-';
    }
    fun[1] = sum;
    for (int k = 0; k < 2; k++) {

      if (k == 0) {
        sum += c;
        ch[2] = '+';
      } else {
        sum -= c;
        ch[2] = '-';
      }
      fun[2] = sum;
      for (int l = 0; l < 2; l++) {
        if (l == 0) {
          sum += d;
          ch[3] = '+';
        } else {
          sum -= d;
          ch[3] = '-';
        }

        if (sum == 7) {
          cout << a << ch[1] << b << ch[2] << c << ch[3] << d << "=7" << endl;
          return 0;
        }
        sum = fun[2];
      }
      sum = fun[1];
    }
    sum = a;
  }

  return 0;
}


Measured memory_bytes: 256
def geta(n=0)
  return $stdin.gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.chomp.split
  end
  return ar.flatten(1) if n<=1
  return ar
end

def jadge(n)
  sqrt = Math.sqrt(n).ceil
  2.step(sqrt) do |i|
    return 0 if n%i == 0
  end
  return 1
end

n = geta(0)
ar = geta(n)

cnt = 0
ar.flatten.map(&:to_i).each do |n|
  cnt += 1 if n == 2
  next if n <= 2
  cnt += jadge(n)
end

p cnt


Measured memory_bytes: 7660
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
mx = max(x)
my = min(y)
flag = False
for z in range(X+1,Y+1):
    if mx < z <= my:
        flag = True
        break
if flag:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define X 610
ll n;
class Con{
  public:
  vector<pair<ll,ll> > g[X][X];
  ll s[X][X];
  void dfs(ll x,ll y,ll c){
    if(~s[x][y])return;
    s[x][y]=c;
    for(auto t:g[x][y]){
      dfs(t.first,t.second,1^c);
    }
  }
  void main(ll d){
    vector<ll> x,y;
    for(int i=-X;i<X;i++)for(int j=-X;j<X;j++){
      if(i*i+j*j==d){
	x.push_back(i); y.push_back(j);
      }
    }
    lol(i,n)lol(j,n){
      for(int k=0;k<x.size();k++){
	ll xx=i+x[k],yy=j+y[k];
	if(xx<0||yy<0||xx>=n||yy>=n)continue;
	g[i][j].push_back(make_pair(xx,yy));
      }
    }
    lol(i,n)lol(j,n)s[i][j]=-1;
    lol(i,n)lol(j,n)dfs(i,j,0);
  }
};Con co[2];
int main(){
    cin>>n;n*=2;
    lol(i,2){
      ll d;
      cin>>d;
      co[i].main(d);
    }
    vector<pair<ll,ll> >v[2][2];
    lol(i,n)lol(j,n){
      v[co[0].s[i][j]][co[1].s[i][j]].push_back(make_pair(i,j));
    }
    lol(i,2)lol(j,2)if(v[i][j].size()>=n*n/4){
      for(int k=0;k<n*n/4;k++){
	cout<<v[i][j][k].first<<" "<<v[i][j][k].second<<endl;
      }
      return 0;
    }
    return 0;
}


Measured memory_bytes: 309580
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

/**
 * AOOJ id=2426
 * Treasure Hunt
 * @author scache
 *
 */
public class Main {
	public static void main(String[] args) {
		Main p = new Main();
	}

	int n;
	int m;
	int[] x;
	int[] y;
	Scanner sc;
	public Main() {
		sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		
		x = new int[n];
		y = new int[n];
		for(int i=0;i<n;i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		solve();
	}

	public void solve() {
		int[] xc = new int[x.length+1];
		int[] yc = new int[y.length+1];
		xc[0] = Integer.MIN_VALUE;
		yc[0] = Integer.MIN_VALUE;
		System.arraycopy(x, 0, xc, 1, x.length);
		System.arraycopy(y, 0, yc, 1, y.length);
		xc = compress(xc);
		yc = compress(yc);
		for(int i=0;i<x.length;i++){
			x[i] = Arrays.binarySearch(xc, x[i]);
			y[i] = Arrays.binarySearch(yc, y[i]);
		}
		
		int[][] count = new int[yc.length][xc.length];
		for(int i=0;i<x.length;i++)
			count[y[i]][x[i]]++;
		
		for(int i=1;i<yc.length;i++)
			for(int j=1;j<xc.length;j++)
				count[i][j] += count[i][j-1];
		
		for(int i=1;i<xc.length;i++)
			for(int j=1;j<yc.length;j++)
				count[j][i] += count[j-1][i];
		
//		for(int i=0;i<count.length;i++)
//			System.out.println(Arrays.toString(count[i]));
		
		for(int i=0;i<m;i++){
			int[] c =new int[4];
			for(int j=0;j<4;j++){
				c[j] = Arrays.binarySearch(j%2==0 ? xc : yc, sc.nextInt());
				c[j] = c[j]>=0 ? c[j] : (c[j]+1)*(-1) - (j<2 ? 0 : 1);
			}
			c[0] = Math.max(0, c[0]-1);
			c[1] = Math.max(0, c[1]-1);
//			System.out.println(Arrays.toString(c));
			System.out.println(count[c[3]][c[2]] + count[c[1]][c[0]]
					-count[c[1]][c[2]] - count[c[3]][c[0]]);
			
		}
		
	}
	
	private int[] compress(int[] a){
		Set<Integer> set = new TreeSet<Integer>();
		for(int i=0;i<a.length;i++){
			set.add(a[i]);
		}
		Iterator<Integer> iter = set.iterator();
		int[] ia = new int[set.size()];
		for(int i=0;i<ia.length;i++)
			ia[i] = iter.next();
		
		return ia;
		
	}
}

Measured memory_bytes: 594956
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

int main(){
	fastread;
	string s;
	cin>>s;
	vector<int> a(26);
	for(char c:s){
		a[c-'a'] += 1;
	}
	for(int i:a){
		// cout<<i<<endl;
		if(i%2){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<functional>
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (a * n > b) {
		cout << b;
	}
	else {
		cout << a * n;
	}
}


Measured memory_bytes: 256
n, m, X, Y = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

if max(x) < min(y) and X < min(y) and Y > max(x) and X < Y:
    print("No War")
    exit()
else:
    print("War")

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

enum UESH { SHITA, UE };

int n;

int main() {
  while (cin >> n) {
    if (n == 0) break;
    int res = 0;
    UESH le = SHITA, ri = SHITA, next = UE;

    for (int i = 0; i < n; ++i) {
      string str; cin >> str;

      if (str == "ld") le = SHITA;
      else if (str == "rd") ri = SHITA;
      else if (str == "lu") le = UE;
      else if (str == "ru") ri = UE;
      
      if (next == le && next == ri) {
	++res;
        if (next == UE) next = SHITA;
	else next = UE;
      }
    }

    cout << res << endl;
  }
}


Measured memory_bytes: 1208
grid = []
dp = []
h,w = [int(x) for x in input().split()]

for i in range(h):
    grid.append(input())
    dp.append([0]*w)

dp[-1][-1] = 1

for i in range(h-1,-1,-1):
    for j in range(w-1,-1,-1):
        if grid[i][j] == '#':
            continue

        if i+1 < h and grid[i+1][j] != '#':
            dp[i][j] += dp[i+1][j]
        if j+1 < w and grid[i][j+1] != '#':
            dp[i][j] += dp[i][j+1]

print(dp[0][0] % int(1e9+7))

Measured memory_bytes: 157556
import sys
 
 
def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    for i in range(1, n):
        if a[i] == a[i-1]:
            print("NO")
            exit()
    print("YES")
 
 
if __name__ == '__main__':
    solve()


Measured memory_bytes: 21940