akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var k = cin.ReadInt;
            var x = cin.ReadInt;
            for(int i = k - 1; i >= 0; i--)
            {
                WriteLine(x - i);
            }
            for(int i = 1; i < k; i++)
            {
                WriteLine(x + i);
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>

int main(){

	int w;		//???????????¬??°
	int n;		//?¨??£??????¬??°
	int a[31];	//???????????????
	int i,x,y,temp;

	// ???????¨??£??????°?????\???????????????
//	while(1){
		scanf("%d", &w);  
//			if ((w < 0) || (w >= 30)) {
//	            printf("30?????§?????´??°????????\?????????????????????\n\a");
//	            continue;
//			}
//			else{
//				break;
//			}
//		}
//	while(1){	
		scanf("%d", &n) ;
//			if ((n < 0) || (n >= 30)) {
//        	    printf("30?????§?????´??°????????\?????????????????????\n\a");
//        	    continue;
//			}
//			else{
//				break;
//			}
//	}
		for(i=1; i<=w; i++){
			a[i] = i;
		}

		//?????????????????\???????????????
		for(i=1; i<=n; i++){
			scanf("%d,%d",&x,&y);
				temp = a[x];
				a[x] = a[y];
				a[y] = temp;
				
		}

		for(i=0;i<w; i++){
			printf("%d\n",a[i+1]);
		}
    return 0;
}

Measured memory_bytes: 596
import sys
n = int(input())
s = input()
if s[0] == "W":
  print(0)
  sys.exit()
MOD = 10**9+7
ans = 1
cnt = 1
right = 1
for i in range(2*n-1):
  if s[i+1] == s[i]:
    right ^= 1
  if right:
    cnt += 1
  else:
    ans *= cnt
    ans %= MOD
    cnt -= 1
if cnt != 0:
  print(0)
else:
  for i in range(1, n+1):
    ans *= i
    ans %= MOD
  print(ans)


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a <= b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first; printf("\n"); }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first; printf(" "); put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first; printf("\n"); putn(rest...); }

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	REP(i, n) {
		cin >> h[i];
	}
	RFOR(i, n, 1) {
		if (h[i] < h[i - 1]) {
			h[i - 1]--;
		}
	}
	
	REP(i, n - 1) {
		if (h[i] > h[i + 1]) {
			put("No");
			return 0;
		}
	}
	put("Yes");
	return 0;
}


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

long long MOD = 1e9+7;

long long fac(long long x) {
  long long y = 1;
  while (x > 0) y = y * x % MOD, x--;
  return y;
}

int main() {
  long long N, M;
  cin >> N >> M;
  cout << ((abs(N - M) > 1) ? 0 : fac(N) * fac(M) % MOD * ((N == M) ? 2 : 1) % MOD) << "\n";
}

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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first
#define psi pair<string,int>

int n;
pair<psi,int> a[150];

bool cmp(pair<psi,int> a,pair<psi,int> b){
  if(a.f.f==b.f.f){
    return a.f.s>b.f.s;
  }
  return a.f.f<b.f.f;
}

int main(){
  cin >> n;
  for(int i=0;i<n;++i){
    cin >> a[i].f.f >> a[i].f.s;
    a[i].s=i+1;
  }
  sort(a,a+n,cmp);
  for(int i=0;i<n;++i){
    cout << a[i].s << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
   #define NUMBER 50
   int main(void){
       int i,c=0,m[NUMBER],f[NUMBER],r[NUMBER];
       for(i=0;i<NUMBER;i++){
          scanf("%d %d %d",&m[i],&f[i],&r[i]);
          if(m[i]==-1&&f[i]==-1&&r[i]==-1)
            break;
          c++;
      }
      for(i=0;i<c;i++){
         if(m[i]==-1||f[i]==-1){
           printf("F\n");
           continue;
         }
         if(m[i]+f[i]>=80){
           printf("A\n");
           continue;
         }
         if(m[i]+f[i]>=65){
           printf("B\n");
           continue;
         }
         if(m[i]+f[i]>=50){
           printf("C\n");
           continue;
         }
         if(m[i]+f[i]>=30&&r[i]>=50){
           printf("C\n");
           continue;
         }else if(m[i]+f[i]>=30){
           printf("D\n");
           continue;
         }else
           printf("F\n");
     }
      return 0;
  }


Measured memory_bytes: 2148
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD 1e9+7

int main(){
	int A, B;
	cin >> A >> B;
	if((A+B)%2 == 0){
		cout << (A+B) / 2 << endl;;
	}
	else{
		cout << "IMPOSSIBLE" << endl;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Schema;

class IDONTKNOWCSHARP
{

    public static void Main()
    {
       if( Console.ReadLine()=="1")
            Console.WriteLine("0");
       else
            Console.WriteLine("1");
    }


    static int[] Convert(string[] v)
    {
        var temp = new int[v.Length];

        for (int i = 0; i < temp.Length; i++)
        {
            temp[i] = int.Parse(v[i]);
        }

        return temp;
    }


    static string[] GetLines()
    {
        return Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    }
}

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

int main() {

long N;
cin>>N;
vector<string> a(N);
map<string,int> b;
for(int i=0;i<N;i++) {
  string s;
  cin>>s;
  b[s]++;
}

long ans=0;

/*
for(int i=0;i<N;i++){

}
*/
cout<<b.size()<<endl;
}


Measured memory_bytes: 25168
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>
#include<vector>

#define LL long long
#define MOD 1000000007

using namespace std;

LL gcd(LL C, LL D) {
	if (C < D) gcd(D, C);

	if (C%D == 0)return D;
	else gcd(D, C%D);
}


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

	int mx = 0, k = 0;
	vector<pair<string, int>>ans(n);

	for (int i = 0; i < n; i++) {
			if (ans.back().first == s[i]) {
				ans.back().second++;
			}
			else {
				ans.push_back(make_pair(s[i],1));
			}
	}

	for (int i = 0; i < ans.size(); i++) {
		mx = max(mx, ans[i].second);
	}

	for (int i = 0; i < ans.size(); i++) {
		if (ans[i].second == mx) {
			cout << ans[i].first << endl;
		}
	}
	
	cin >> n;
	return 0;

}





Measured memory_bytes: 20608
const main = (input) => {
    S = input.split("").map(n => Number(n));
    if (S[0] !== S[1] && S[1] !== S[2] && S[2] !== S[3]) {
        console.log("Good");
    } else {
        console.log("Bad");
    }
};

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

Measured memory_bytes: 21192
import sys

input = sys.stdin.readline
INF = 10 ** 18


def main():
    N = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        ans = 0
    else:
        ans = 1
        for a in A:
            ans *= a
            if ans > INF:
                ans = -1
                break

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 21912
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int i,n,k;
  cin >> n >> k;
  int p[1010];
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  sort(p,p+n);
  int sum=0;
  for(i=0;i<k;i++){
    sum+=p[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

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

    int N, H, maxa = 0;
    cin >> N >> H;
    vector<int> a(N), b(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i] >> b[i];
        maxa = max(maxa, a[i]);
    }

    sort(b.begin(), b.end(), greater<int>());

    int sumb = 0, ans = 0;
    for (int i = 0; i < N; ++i) {
        if (b[i] > maxa && sumb < H) {
            sumb += b[i];
            ans++;
        }
    }

    ans += max(H - sumb + maxa - 1, 0) / maxa;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200010

long long kai[N];
long long rkai[N];
long long xx[30];
int yy[30];

void kaiz(void){
	kai[0] = 1;
	f(i, N - 1){
		kai[i + 1] = kai[i] * (i + 1);
		kai[i + 1] = kai[i + 1] % MOD;
	}
	int x = MOD - 2;
	f(i, 30){
		if (x % 2 == 1)yy[i] = 1;
		else yy[i] = 0;
		x = x / 2;
	}
	f(i, N){
		xx[0] = kai[i];
		f(j, 29){
			xx[j + 1] = xx[j] * xx[j];
			xx[j + 1] = xx[j + 1] % MOD;
		}
		rkai[i] = 1;
		f(j, 30){
			if (yy[j] == 1){
				rkai[i] = rkai[i] * xx[j];
				rkai[i] = rkai[i] % MOD;
			}
		}
	}
}

long long ni(long long x, long long y){
	if (x < 0 || y<0 || y>x)return 0;
	long long re = kai[x];
	re = re*rkai[x - y];
	re = re%MOD;
	re = re*rkai[y];
	re = re%MOD;
	return re;
}


int main(){
	long long q, n, m, h, k;
	long long w,x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	kaiz();

	scanf("%lld %lld %lld %lld", &n, &m, &h, &k);
	x = n - h;
	y = m - k;
	z = n - h + k - 1;
	x = min(x, y);
	f(i, x){
		s = ni(z, k + i);
		y = ni(n + m - z - 2, h + i);
		s = s*y;
		s = s%MOD;
		ans += s;
		ans = ans%MOD;

	}
	printf("%lld\n", ans);




	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a;
    a=n%10;
    n/=10;
    n/=10;
    if(a==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};

struct Bipartite_Graph : UnionFind {
  vector< int > color;

  Bipartite_Graph(int v) : color(v + v, -1), UnionFind(v + v) {}

  bool bipartite_graph_coloring() {
    for(int i = 0; i < color.size() / 2; i++) {
      int a = find(i);
      int b = find(i + (int) color.size() / 2);
      if(a == b) return (false);
      if(color[a] < 0) color[a] = 0, color[b] = 1;
    }
    return (true);
  }

  void unite_diff(int x, int y) {
    unite(x, y + color.size() / 2);
    unite(y, x + color.size() / 2);
  }

  bool operator[](int k) {
    return (bool(color[find(k)]));
  }
};

int main() {
  int N, D1, D2;
  cin >> N >> D1 >> D2;
  vector< pair< int, int > > xs, ys;
  for(int i = -2 * N; i <= 2 * N; i++) {
    for(int j = -2 * N; j <= 2 * N; j++) {
      int sum = i * i + j * j;
      if(sum == D1) xs.emplace_back(i, j);
      if(sum == D2) ys.emplace_back(i, j);
    }
  }
  auto isin = [&](int x, int y) {
    return 0 <= x && x < 2 * N && 0 <= y && y < 2 * N;
  };
  Bipartite_Graph latte(4 * N * N), malta(4 * N * N);
  for(int i = 0; i < 2 * N; i++) {
    for(int j = 0; j < 2 * N; j++) {
      for(auto &x : xs) {
        if(isin(i + x.first, j + x.second)) {
          latte.unite_diff(i * (2 * N) + j, (i + x.first) * (2 * N) + (j + x.second));
        }
      }
      for(auto &y : ys) {
        if(isin(i + y.first, j + y.second)) {
          malta.unite_diff(i * (2 * N) + j, (i + y.first) * (2 * N) + (j + y.second));
        }
      }
    }
  }
  assert(latte.bipartite_graph_coloring());
  assert(malta.bipartite_graph_coloring());
  vector< int > lis[4];
  for(int i = 0; i < 4 * N * N; i++) {
    lis[latte[i] << 1 | malta[i]].emplace_back(i);
  }
  for(int i = 0; i < 4; i++) {
    if(lis[i].size() >= N * N) {
      lis[i].resize(N * N);
      for(auto &p : lis[i]) {
        cout << p / (2 * N) << " " << p % (2 * N) << endl;
      }
      return 0;
    }
  }
}


Measured memory_bytes: 14136
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long n,m,a,b,ans=0;
    cin>>n>>m;
    vector<pair<long long,long long>>c(n);
    f(i,0,n){
        cin>>a>>b;
        c[i]=make_pair(a,b);
    }
    sort(c.begin(),c.end());
    f(i,0,n){
        ans+=min(c[i].second,m)*c[i].first;
        m-=c[i].second;
        if(m<=0){
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4836
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
char da[4] = { 'R', 'L', 'D', 'U' };
char dax[4] = { -1, 1, -1, 1 };
char dax2[4] = { 1, -1, 1, -1 };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }

int main() {

	ll A, P;

	cin >> A >> P;


	cout << (3 * A + P) / 2 << endl;

	return 0;

}

Measured memory_bytes: 256
"use strict"

const printArray = (xs) => {
  console.log(xs.join(" "))
}

const bubbleSort = (n, xs) => {
  for (let i = 0; i < xs.length; i++) {
    for (let j = xs.length-1; j > i; j--) {
      if (xs[j] < xs[j-1]) {
        const tmp = xs[j-1]
        xs[j-1] = xs[j]
        xs[j] = tmp
        count++
      }
    }
  }
}

let count = 0

let n = -1
const xs = []
const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function (line) {
  if (n === -1) {
    n = Number(line)
  } else {
    const xs = line.split(" ").map(x => Number(x))
    bubbleSort(n, xs)
    printArray(xs)
    console.log(count)
    process.exit(0)
  }
})



Measured memory_bytes: 16532
import java.util.*;
 
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        if (N % 1000 == 0) {
            System.out.println(0);
        } else {
            System.out.println(1000 - N % 1000);
        }
        
	}
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int count[26] = {};
    for(int i = 0 ; i < s.length() ; i++)
    {
        count[s[i]-'a']++;
    }
    for(int i = 0 ; i < 26 ; i++)
    {
        if(count[i] == 0)
        {
            char c = 'a' + i;
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
//#pragma GCC optimize("O2")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const int maxn = 2e5 + 55;
const int mod = 1e9 + 7;
ll n, d, a, r[maxn];
vpi t;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> d >> a;
	t.resize(n);
	for(auto &i : t) cin >> i.first >> i.second;
	sort(all(t));
	ll run = 0, u = 0, j = 0;
	for(int i = 0; i < n; i++) {
		j = max(j, (ll)i);
		while(j < n && t[j].first <= t[i].first+2*d) j++;
		run += r[i];
		t[i].second += run;
		if(t[i].second>0) {
		ll tm = (t[i].second+a-1)/a;
		run -= tm*a;
		u += tm;
		r[j] += tm*a;
		}
	}
	cout << u;
}


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

int main(){
	int n;
	cin>>n;
	int arr[n+1];
	arr[n]=1231232;
	int top=0;
	for(int i=0;i<n;i++)cin>>arr[i];
	sort(arr,arr+n);
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
		    int m=0;
		    int k=j+1;
			while(arr[i]+arr[j]>arr[k]){k++;m++;}
			top+=m;
			
		}
	}
	cout<<top;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x, n, i;
    map<int,bool> index;
    cin >> x >> n;
    int mx = INT_MIN, mn = INT_MAX;
    for(i=0; i<n; i++){
        int input;
        cin >> input;
        index[input] = true;
        mx = max(mx, input);
        mn = min(mn, input);
    }
    if(!index[x]){
        cout << x << '\n';
        return 0;
    }
    vector<int> res;
    for(i=x+1; i<=mx+1; i++){
        if(!index[i]){
            res.push_back(i);
            break;
        }
    }
    for(i=x-1; i>=mn-1; i--){
        if(!index[i]){
            res.push_back(i);
            break;
        }
    }
    if(abs(res.front()-x) < abs(res.back()-x))
        cout << res.front() << '\n';
    else if(abs(res.front()-x) > abs(res.back()-x))
        cout << res.back() << '\n';
    else{
        if(res.front() <= res.back())
            cout << res.front() << '\n';
        else
            cout << res.back() << '\n';
    }
    return 0;
}


Measured memory_bytes: 3604
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	int a = (int) s.size();
	int b = (int) t.size();
	int ans = b;
	for (int i = 0; i <= a - b; i++) {
		string ss = s.substr(i, b);
		int cnt = 0;
		for (int j = 0; j < b; j++) {
			if (t[j] != ss[j]) {
				cnt++;
			}
		}
		ans = min(ans, cnt);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3604
H,W=map(int,input().split())
N=int(input())
a=list(map(int,input().split()))

ans=[]
for i in range(N):
  ans.extend([i+1]*a[i])
  
for i in range(H):
  if i % 2 == 0:
    print(*ans[i*W:(i+1)*W])
  else:
    print(*ans[i*W:(i+1)*W][::-1])

Measured memory_bytes: 9464
#include<stdio.h>
typedef struct{
    int x; int y;
}Tile;
//mv[4][x,y]
int mv[4][2]={{-1,0},{0,-1},{1,0},{0,1}};
int main(void){
    while(1){
        Tile tile[200];
        tile[0].x=0,tile[0].y=0;
        int left=0,right=0,up=0,down=0;
        int N;
        scanf("%d",&N);
        if(N==0) break;
        for(int i=1;i<N;i++){
            int n,d;
            scanf("%d%d",&n,&d);
            tile[i].x=tile[n].x+mv[d][0];
            tile[i].y=tile[n].y+mv[d][1];
            if(left>tile[i].x) left=tile[i].x;
            if(right<tile[i].x) right=tile[i].x;
            if(up<tile[i].y) up=tile[i].y;
            if(down>tile[i].y) down=tile[i].y;
        }
        printf("%d %d\n",right-left+1,up-down+1);
    }
}



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


int cnt;

std::vector<int> insertionSort(std::vector<int> ls, int n, int g) {
	int v, j;
	for (int i = g; i < n; i++) {
		v = ls[i];
		j = i - g;
		while (j >= 0 && ls[j] > v) {
			ls[j + g] = ls[j];
			j = j - g;
			cnt++;
		}
		ls[j + g] = v;
	}
	return ls;
}

void shellSort(std::vector<int> ls, int n) {
	cnt = 0;
	int m;
	if (n == 1) {
		m = 1;
	}
	else {
		m = log(n) / log(2);
	}
	
	std::vector<int> G(m);
	for (int i = 0, j = m; i < m; i++, j--) {
		if (i == m - 1) {
			G[i] = 1;
		}
		else {
			G[i] = pow(2, j);
		}
	}
	 
	for (int i = 0; i < m; i++) {
		ls = insertionSort(ls, n, G[i]);
	}
	std::cout << m << "\n";
	
	for (int i = 0; i < m - 1; i++) {
		std::cout << G[i] << " ";
	}
	std::cout << G[m - 1] << "\n";
	std::cout << cnt << "\n";
	for (int i = 0; i < n; i++) {
		std::cout << ls[i] << "\n";
	}
}

std::vector<int> scan(int size) {
	std::vector<int> ls(size);
	for (int i = 0; i < size; i++) {
		std::cin >> ls[i];
	}
	return ls;
}

int main() {
	int size;
	std::cin >> size;
	shellSort(scan(size), size);
	return 0;
}



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

int main(){
    int n;  cin>>n;
    int d = floor(log10(n))+1, ans=0;
    if(d&1){
        ans = n-pow(10,d-1)+1;
        d-=2;
    }else
        d--;
    for(;d>0;d-=2)
          ans += pow(10,d)-pow(10,d-1); 
    cout<<ans<<endl;
}

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

if n>=m:
    print(0)
    exit()

sa = []
for i in range(len(x)-1):
    sa.append(x[i+1] - x[i])
sa.sort()
sa.reverse()
ans = sum(sa)
for i in range(n-1):
    ans -= sa[i]
print(ans)

Measured memory_bytes: 13968
#include<bits/stdc++.h>
#define ll long long
using namespace std;

const int N=2e5 +5;
ll a[N];

int main(){

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; ++i)
        scanf("%lld", a+i);

    long long cnt=0, num=0, sum=0;
    int idx=0;
    for(int i=0; i<=n; ++i){
        if(i==n){
            idx=n;
            break;
        }

        if( (num^a[i]) == (sum+a[i]) ){
            cnt+=1LL*(i+1);
            num^=a[i];
            sum+=a[i];
        }
        else{
            idx=i;
            break;
        }
    }

    int i=0, j=idx;
    while(j<n){
        if( (num^a[j]) == (sum+a[j]) ){
            cnt+=1LL*(j-i+1);
            num^=a[j];
            sum+=a[j];
            ++j;
        }
        else{
            num^=a[i];
            sum-=a[i];
            ++i;
        }
    }

    printf("%lld\n", cnt);





    return 0;
}


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

public class hello
{
	public static int[] m;

	public static void Main()
	{
		var m0 = new int[] { 1, 20, 18, 20, 20, 13 };
		m = new int[6];
		m[0] = m0[0];
		for (int i = 1; i < 6; i++) m[i] = m[i - 1] * m0[i];
		Array.Reverse(m);

		while (true)
		{
			string[] s = Console.ReadLine().Trim().Split('.');
			if (s[0] == "#") break;
			var a = new List<int>();
			for (int i = 0; i < s.Length; i++) a.Add(int.Parse(s[i]));
			var ans = getAns(a);
			Console.WriteLine(string.Join(".", ans));
		}
	}

	static List<long> getAns(List<int> a)
	{
		var ans = new List<long>();

		if (a.Count() == 3)
		{
			var d1 = GetDays(a[0], a[1], a[2]);
			var d2 = GetDays(2012, 12, 21);
			var diff = d1 - d2;
			var answ = new long[6];
			for (int i = 0; i < 6; i++)
			{
				answ[i] = diff / m[i];
				if (i > 0) ans.Add(answ[i]);
				diff -= answ[i] * m[i];
			}
		}
		else
		{
			var diff = 0;
			for (int i = 0; i < 5; i++)
				diff += a[i] * m[i + 1];
			var dt = new DateTime(2012, 12, 21).AddDays(diff);
			ans.Add(dt.Year);
			ans.Add(dt.Month);
			ans.Add(dt.Day);
		}
		return ans;
	}
	static long GetDays(long y, int m, int d)
	{
		if (m <= 2)
		{
			--y;
			m += 12;
		}
		long dy = 365 * (y - 1);
		long c = y / 100;
		long dl = (y >> 2) - c + (c >> 2);
		int dm = (m * 979 - 1033) >> 5;
		return dy + dl + dm + d - 1;
	}
}



Measured memory_bytes: 18360
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int digit(int i, int d){
    return (i / (int) pow(10,d))%10;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  int sm = 0;
  FOR(i,a,b+1){
    
      if (digit(i,4)==digit(i,0) && digit(i,3)==digit(i,1))sm++;
  }
  cout << sm << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d});
    return 0;
}


Measured memory_bytes: 3664
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    string s[4];
    rep(i,3) cin>>s[i];
    rep(i,3) cout<<s[i][i];
    cout<<endl;
}




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b, end='')

Measured memory_bytes: 40168
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
  std::vector<int> vec(10);
  for(int i = 0; i < 10; i++){
    std::cin >> vec[i];
  }
  std::sort(vec.begin(), vec.end(), std::greater<int>());
  for(int i = 0; i < 3; i++){
    std::cout << vec[i] << std::endl;
  }
}

Measured memory_bytes: 1212
#####segfunc######
class SegTree:
    def segfunc(self, x, y):
        return max(x,y)

    def __init__(self, init_val):
        #set_val
        #####単位元######
        self.ide_ele = 0
        n = len(init_val)
        #num:n以上の最小の2のべき乗
        self.num =2**(n-1).bit_length()
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        #built
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res



N = int(input())

S = list(input())
ALPHAS = [[0] * (N+1) for i in range(26)]
alpha2num = lambda c: ord(c) - ord('a')
for i in range(N):
    ALPHAS[alpha2num(S[i])][i] = 1
for i,alpha in enumerate(ALPHAS):
    ALPHAS[i] = SegTree(alpha)
ALPHAS = tuple(ALPHAS)
Q = int(input())
for _ in range(Q):
    q,a,b = map(lambda c:c,input().split())
    if q == '2':
        l = int(a)-1
        r = int(b)
        ans = 0
        for i in range(26):
            ans += ALPHAS[i].query(l,r)
        print(ans)
    if q == '1':
        i = int(a)-1
        p_s = S[i]
        s = b
        S[i] = s
        ALPHAS[alpha2num(p_s)].update(i,0)
        ALPHAS[alpha2num(s)].update(i,1)

Measured memory_bytes: 354156
fun main(args: Array<String>){
    val (N, A, B, C) = readLine()!!.split(" ").map { it.toInt() }
    val l = IntArray(N){ readLine()!!.toInt() }

    fun dfs(count : Int, a: Int, b: Int, c: Int): Int{
        if(count == N){
            if(a != 0 && b != 0 && c != 0){
                return Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c) - 30
            }else{
                return Int.MAX_VALUE / 10
            }
        }
        var min = Int.MAX_VALUE / 10
        min = Math.min(min, dfs(count + 1, a, b, c))
        min = Math.min(min, dfs(count + 1, a + l[count], b, c) + 10)
        min = Math.min(min, dfs(count + 1, a, b + l[count], c) + 10)
        min = Math.min(min, dfs(count + 1, a, b, c + l[count]) + 10)
        return min
    }
    println(dfs(0, 0, 0, 0))
}

Measured memory_bytes: 38264
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  int n,cnt=0;
  cin>>n;
  string s;
  cin>>s;
  cnt=n-1-count(s.begin()+1,s.end(),'W');
  int ans=cnt;
  rep(i,n-1){
    if(s[i]=='E' && s[i+1]=='E'){
      cnt--;
    }else if(s[i]=='W' && s[i+1]=='W'){
      cnt++;
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 900
N,M = list(map(int,input().split()))
a_list = list(map(int,input().split()))
bc_list = []
for _ in range(M):
    b,c = list(map(int,input().split()))
    bc_list.append([b,c])

a_list = sorted(a_list)
bc_list = sorted(bc_list,key=lambda x: x[1],reverse=True)

tmp = 0
for i,a in enumerate(a_list):
    if tmp >= len(bc_list):
        break
    
    if a < bc_list[tmp][1]:
        bc_list[tmp][0] -= 1
        a_list[i] = bc_list[tmp][1]
    else:
        break

    if bc_list[tmp][0] == 0:
        tmp += 1
print(sum(a_list))

Measured memory_bytes: 81900
<?php
$hms = new HMSConverter(fgets(STDIN));
echo sprintf('%d:%d:%d', $hms->h(), $hms->m(), $hms->s()), PHP_EOL;

class HMSConverter
{
    protected $second;

    public function __construct($second)
    {
        $this->second = (int) $second;
    }

    public function h()
    {
        return floor($this->second / 60 / 60);
    }

    public function m()
    {
        return floor($this->second / 60) % 60;
    }

    public function s()
    {
        return $this->second % 60;
    }

}

Measured memory_bytes: 15344
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()

ans=0
for i in range(n):
  if i%2==0 and a[i]%2==1:
    ans+=1

print(ans)

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

const int INF = 1<<28;

int main() {
  for(int W; cin >> W; ) {
    vector<int> a(W);
    for(int i = 0; i < W; ++i) cin >> a[i];
    vector<int> A(W), B(W);
    A[0] = a[0] == 0 ? INF : 0;
    for(int i = 1; i < W; ++i) {
      if(a[i] == 0) A[i] = INF;
      else {
        A[i] = max(0, A[i-1] - 1);
        if(a[i] < 0) A[i] = min(A[i], -a[i]);
      }
    }
    B[W-1] = a[W-1] == 0 ? INF : 0;
    for(int i = W-2; i >= 0; --i) {
      if(a[i] == 0) B[i] = INF;
      else {
        B[i] = max(0, B[i+1] - 1);
        if(a[i] < 0) B[i] = min(B[i], -a[i]);
      }
    }
    int res = 0;
    for(int i = 0; i < W; ++i) {
      if(a[i] > 0) {
        res += min(a[i], max(A[i], B[i]));
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 2328
a = input()
a = input()
# a = '5 6 8 10'
# a = '382253568 723152896 37802240 379425024 404894720 471526144'
d = a.split()
cnt = 0
run = 1
while(run):
    for i in d:
        if(int(i)%2==1):
            run = 0
            break
    if(run):
        cnt = cnt + 1
        j = 0
        for i in d:
            d[j] = int(d[j])/2
            j = j + 1
print(cnt)


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

int main(){
   int n,x;
   int ans=inf;
   cin >> n >> x;
   rep(i,n){
       int c,t;
       cin >>c>>t;
       if(t>x) continue;
       else ans=min(ans,c);
   }
   if(ans==inf){
       cout << "TLE" << endl;
       return 0;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static final FS sc = new FS();  // 封装输入类
    static final PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = sc.nextArray(n);
        int res = 0;
        for(int i = 1;i <= n;i += 2) {
            if (a[i - 1] % 2 == 1) {
                res++;
            }
        }
        pw.println(res);
        pw.flush();
    }

    static class FS {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch(Exception ignored) {}
            }
            return st.nextToken();
        }
        int[] nextArray(int n) {
            int[] a = new int[n];
            for(int i = 0;i < n;i++) {
                a[i] = nextInt();
            }
            return a;
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32800
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer>a = new ArrayList<Integer>();
    int aa;
    for(int i=0;i<n;i++){
      aa = sc.nextInt();
      a.add(aa);
    }
    double gyaku = 0;
    for(int i=0;i<n;i++){
      gyaku += 1.0/a.get(i);
    }
    System.out.println(1.0/gyaku);
  }
}


Measured memory_bytes: 21844
//
// Created by 李青坪 on 2018/12/7.
//

#include <cmath>
#include <cstdio>
//#include <assert.h>
#include <algorithm>

#define EPSLON 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPSLON)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK -2
#define ONLINE_FRONT 2
#define ON_SEGMENT 0

using namespace std;

// 点
class Point {
public:
    double x;
    double y;

    Point() {}

    Point(double x, double y) : x(x), y(y) {}

    Point operator+(Point a) {
        return Point(x + a.x, y + a.y);
    }

    Point operator-(Point a) {
        return Point(x - a.x, y - a.y);
    }

    Point operator*(double a) {
        return Point(x * a, y * a);
    }

    Point operator/(double a) {
        return Point(x / a, y / a);
    }

    double norm() {
        return x * x + y * y;
    }

    double absVector() {
        return sqrt(norm());
    }

    bool operator==(Point a) const {
        return equals(x, a.x) && equals(y, a.y);
    }
};

typedef Point Vector;

// 线段
class Segment {
public:
    Point a, b;
};

typedef Segment Line;

class Circle {
public:
    Point c;
    double r;
};

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

double arg(Vector p) {
    return atan2(p.y, p.x);
}

Vector polar(double a, double r) {
    return Point(a * cos(r), a * sin(r));
}

pair<Point, Point> getCrossPoints(Circle c1, Circle c2) {
    double d = (c2.c - c1.c).absVector();
    double t = arg(c2.c - c1.c);
    double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    return make_pair(c1.c + polar(c1.r, t + a), c1.c + polar(c1.r, t - a));
}

int main() {
    Circle c1, c2;
    double x, y, r;
    scanf("%lf %lf %lf", &x, &y, &r);
    c1.c.x = x;
    c1.c.y = y;
    c1.r = r;
    double x1, y1, r1;
    scanf("%lf %lf %lf", &x1, &y1, &r1);
    c2.c.x = x1;
    c2.c.y = y1;
    c2.r = r1;
    pair<Point, Point> re = getCrossPoints(c1, c2);
    if (re.first.x == re.second.x && re.first.y == re.second.y) {
        printf("%.8lf %.8lf %.8lf %.8lf\n", re.first.x, re.first.y, re.second.x, re.second.y);
    } else if (re.first.x < re.second.x) {
        printf("%.8lf %.8lf %.8lf %.8lf\n", re.first.x, re.first.y, re.second.x, re.second.y);
    } else {
        if (re.first.x == re.second.x) {
            if (re.first.y < re.second.y) {
                printf("%.8lf %.8lf %.8lf %.8lf\n", re.first.x, re.first.y, re.second.x, re.second.y);
            } else {
                printf("%.8lf %.8lf %.8lf %.8lf\n", re.second.x, re.second.y, re.first.x, re.first.y);
            }
        } else {
            printf("%.8lf %.8lf %.8lf %.8lf\n", re.second.x, re.second.y, re.first.x, re.first.y);
        }
    }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

vi adj[100001];
int deg[100001];
int h[100001];
priority_queue<ii> leaves;
int par[100001];

void dfs(int u, int p)
{
	int ch=0;
	for(int i=0;i<adj[u].size();i++)
	{
		int v=adj[u][i];
		if(v==p) continue;
		h[v]=h[u]+1;
		par[v]=u;
		dfs(v,u);
		ch++;
	}
	if(ch==0)
	{
		leaves.push(mp(h[u],u));
	}
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int u,v; 
		cin>>u>>v;
		u--; v--;
		adj[u].pb(v);
		adj[v].pb(u);
		deg[u]++;deg[v]++;
	}
	par[0]=-1;
	dfs(0,-1);
	while(!leaves.empty())
	{
		int u = leaves.top().se;
		leaves.pop();
		if(par[u]==-1)
		{
			cout<<"First\n";
			return 0;
		}
		int p =par[u];
		if(par[p]==-1)
		{
			if(deg[p]>1)
			{
				cout<<"First\n";
				return 0;
			}
			else
			{
				cout<<"Second\n";
				return 0;
			}
		}
		else
		{
			if(deg[p]>2)
			{
				cout<<"First\n";
				return 0;
			}
			int pp = par[p];
			deg[pp]--;
			if(deg[pp]<=1)
			{
				leaves.push(mp(h[pp],pp));
			}
		}
	}
	
}


Measured memory_bytes: 8700
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll W, H, N;
  cin >> W >> H >> N;
  vector<ll> x(N), y(N), a(N);
  ll min_y = 0, min_x = 0;
  ll max_y = H, max_x = W;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> a[i];
    switch (a[i]) {
      case 1:
        if (min_x < x[i] && x[i] < max_x) {
          min_x = x[i];
        } else if (x[i] >= max_x) {
          cout << 0 << endl;
          return 0;
        }
        break;
      case 2:
        if (min_x < x[i] && x[i] < max_x) {
          max_x = x[i];
        } else if (min_x >= x[i]) {
          cout << 0 << endl;
          return 0;
        }
        break;
      case 3:
        if (min_y < y[i] && y[i] < max_y) {
          min_y = y[i];
        } else if (y[i] >= max_y) {
          cout << 0 << endl;
          return 0;
        }
        break;
      case 4:
        if (min_y < y[i] && y[i] < max_y) {
          max_y = y[i];
        } else if (min_y >= y[i]) {
          cout << 0 << endl;
          return 0;
        }
        break;
      default:
        break;
    }
  }
  ll ans = max((max_x - min_x) * (max_y - min_y), 0LL);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

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

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

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

void solve() {
  string s; cin >> s;

  if (s[0] != 'A') {
    outl("WA");
    return;
  } else {
    s[0] = 'a';
  }

  int cntC = 0;
  for (int i = 2; i <= s.size() - 2; i++) {
    if (s[i] == 'C') {
      cntC++;
      s[i] = 'c';
    }
  }
  if (cntC != 1) {
    outl("WA");
    return;
  }

  for (int i = 0; i < s.size(); i++) {
    if (s[i] < 'a' || s[i] > 'z') {
      outl("WA");
      return;
    }
  }

  outl("AC");
}

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

  solve();
}


Measured memory_bytes: 888
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	long long int a[7];
	for(int i = 0; i < 7; i++){
		cin >> a[i];
	}
	long long int ans = 0;
	if(a[0] > 0 && a[3] > 0 && a[4] > 0){
		ans = 3;
		long long int tmp = min((a[0] - 1) / 2, a[1]);
		ans += 3 * tmp;
		ans += ((a[0] - 1 - tmp * 2) / 2) * 2;
		ans += a[1] - tmp;
		ans += ((a[3] - 1) / 2) * 2 + ((a[4] - 1) / 2) * 2;
	}
	long long int tmp = min(a[0] / 2, a[1]);
	ans = max(ans, 3 * tmp + ((a[0] - tmp * 2) / 2) * 2 + a[1] - tmp + (a[3] / 2) * 2 + (a[4] / 2) * 2);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, p = map(int, input().split())
temp = p
ans = 1
for i in range(2, int(-(-(p**0.5) // 1)) + 1):
    if temp % i == 0:
        cnt = 0
        while temp % i == 0:
            cnt += 1
            temp //= i
        ans *= i**(cnt // n)
if temp != 1:
    ans *= temp*(n == 1) or 1
print(ans)


Measured memory_bytes: 9396