akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 2e5 + 10;

void TLE(const string &s) {
    static int imosArray[26][MAX];
    static int* imos[26];
    auto isKaibun = [&] (int l, int r) {
        int odd = 0;
        REP(i, 26) odd += (imos[i][r - 1] - imos[i][l - 1]) % 2;
        return odd < 2;
    };
    static VI dp;
    const int L = s.size();
    REP(i, 26) {
        imos[i] = &imosArray[i][1];
    }
    REP(i, s.size()) {
        imos[s[i] - 'a'][i]++;
    }
    REP(i, 26) REP(j, MAX - 2) {
        imos[i][j + 1] += imos[i][j];
    }
    dp = VI(L + 1, L); // dp[i] := i) の最小
    dp[0] = 0;
    REP(i, L) {
        dp[i + 1] = min(dp[i + 1], dp[i] + 1);
        FOR(j, i + 1, L + 1) {
            if (isKaibun(i, j)) {
                dp[j] = min(dp[j], dp[i] + 1);
            }
        }
    }
    cout << dp[L] << endl;
}

void Fast(const string &S) {
    static int dp[1 << 26];
    const int L = S.length();
    fill(dp, dp + (1 << 26), L);
    int bit = 0;
    dp[bit] = 0;
    for (int i = 0; i < L; i++) {
        bit ^= (1 << (S[i] - 'a'));
        for (int j = 0; j < 26; j++) {
            dp[bit] = min(dp[bit], dp[bit ^ (1 << j)] + 1);
        }
    }
    int ans = __builtin_popcount(bit) <= 1 ? 1 : dp[bit];
    cout << ans << endl;
}

int main(void) {
    string s;
    cin >> s;
    //TLE(s);
    Fast(s);
}


Measured memory_bytes: 264708
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var t = int.Parse(line[1]);
        var anscost = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (b <= t && a < anscost) { anscost = a; }
        }
        if (anscost == int.MaxValue) Console.WriteLine("TLE");
        else Console.WriteLine(anscost);
    }
}


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

int main(){
  int n;
  cin >> n;
  int counter[6] = {0};
  for (int i = 0; i < n; i++) {
    double hight;
    cin >> hight;
    counter[(int)((hight - 160)/5)]++;
  }
  for (int i = 0; i < 6; i++) {
    std::cout << i + 1 << ":";
    while(counter[i] > 0){
      std::cout << '*';
      counter[i]--;
    }
    std::cout << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>

int main(void){
    int D;
    scanf("%d",&D);
    if(D==25){printf("Christmas\n");}
    if(D==24){printf("Christmas Eve\n");}
    if(D==23){printf("Christmas Eve Eve\n");}
    if(D==22){printf("Christmas Eve Eve Eve\n");}
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/ruby
px,py=gets.split.map(&:to_f)
cx,cy,r=gets.split.map(&:to_f)
pxd=px-cx
pyd=py-cy
z=Math.sqrt((pxd**2+pyd**2)-r**2)
w=pxd**2+pyd**2
puts [[r*(r*pxd+pyd*z)/w+cx,r*(r*pyd-pxd*z)/w+cy],[r*(r*pxd-pyd*z)/w+cx,r*(r*pyd+pxd*z)/w+cy]].sort.map{|e|e*' '}

Measured memory_bytes: 8792
#include<stdio.h>
#define MODN 1000000007

static inline long modadd(long a,long b){
    return (a+b) % MODN;
}

int main(void){
    register int i;
    int n;
    scanf("%d",&n);
    int c[n];
    for(i = 0;i < n;i++)scanf("%d",&c[i]);
    long dp[n];
    dp[0] = 1;
    static long hst[200200];
    hst[c[0]] = 1;
    for(i = 0;i< n-1;i++){
        if(c[i] == c[i+1]){
            dp[i+1] = dp[i];
            continue;
        }
        dp[i+1] = modadd(dp[i],hst[c[i+1]]);
        hst[c[i+1]] = dp[i+1];
    }
    printf("%ld",dp[n-1]);
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
struct node{
    int x;
	int qwq;
}a[100001];
bool cmp(node a,node b)
{
    return a.x<b.x;
}
int n,l,t,ans;
int main()
{
	cin>>n>>l>>t;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i].x>>a[i].qwq;
    	a[i].qwq--;
    }
    for(int i=1;i<=n;i++)
    	a[i].x=a[i].qwq?a[i].x-t:a[i].x+t,ans=a[i].x%l<0?ans+a[i].x/l-1:ans+a[i].x/l,a[i].x=(a[i].x%l+l)%l;
    sort(a+1,a+n+1,cmp);
    ans=(ans%n+n)%n;
    for(int i=ans+1;i<=n;i++)
    	cout<<a[i].x<<endl;
    for(int i=1;i<=ans;i++)
    	cout<<a[i].x<<endl;
    return 0;
}

Measured memory_bytes: 1920
package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
	mod int = 1e9 + 7
)

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	N := getInt()
	s := make([]int, N)
	for i := 0; i < N; i++ {
		A := getInt()
		s[A-1] = i + 1
	}

	printIntArray(s)
}

func getInt() int {
	sc.Scan()
	str := sc.Text()
	value, _ := strconv.Atoi(str)
	return value
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

signed main()
{
	int R, G, B, N; cin >> R >> G >> B >> N;
	int cnt{};
	for(int r = 0; R*r <= N; ++r){
		for(int g = 0; G*g+R*r <= N; ++g){
			int b = (N-R*r-G*g)/B;
			if(R*r+G*g+B*b == N)++cnt;
		}
	}

	cout << cnt;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	LL N=2e5+10;
	LL a[N];
	LL n,sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	LL mn=1e18,x=0;
	for(int i=0;i<n-1;i++){
		x+=a[i];
		mn=min(mn,abs(sum-2*x));
	}
	cout<<mn<<endl;
    return 0;
}

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

int main() {
    int N; cin >> N;
    long long sum = 1;
    for (int i = 1; i <= N; i++) {
        sum *= i;
        if (sum >= 1000000007) {
            sum %= 1000000007;
        }
    }
    cout << sum  << endl;
}

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

int main() {
    string s;
    cin >> s;
    if(((s[0]==s[1]&&s[1]==s[2]))||(s[1]==s[2]&&s[2]==s[3])){
        cout << "Yes";
    }
    else cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,k;
  cin>>n>>k;
  vector<long long> h(n);
  for(long long i=0;i<n;i++){
    cin>>h[i];
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  long long ans=0;
  for(long long i=0;i<n;i++){
    if(i<k){
      h[i]=0;
    }
    else{
      while(h[i]>0){
        h[i]--;
        ans++;
      }
    }
  }
  cout<<ans<<endl;
      
}

Measured memory_bytes: 1792
void main() {
	auto ip = readAs!(int[]), N = ip[0], A = ip[1], B = ip[2];
	writefln("%d %d", min(A, B), max(0, -N + A+B));
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

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

ll xxor(ll a) {
	if(a % 4 == 0)return a; //左の1同士が打ち消される
	if(a % 4 == 1)return 1;
	if(a % 4 == 2)return a + 1;
	return 0;
}

int main()
{
	ll a, b; cin >> a >> b;
	a--;
	cout << (xxor(b) xor xxor(a)) << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define tox x+dx[i]
#define toy y+dy[i]
using namespace std;

inline ll read(){
    ll x=0,f=1;
    char ch=getchar();
    for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+ch-48;
    return x*f;
}

struct node{
    int x,y,pos;
}a[1000000];

int b[200000][20];

int cmp(node a1,node a2){
    if (a1.x==a2.x) return a1.y<a2.y;
    return a1.x<a2.x;
}

int main(){
   // freopen("a.in","r",stdin);
    int n=read(),m=read(),sum=0;
    for(int i=1;i<=m;i++) a[i].x=read(),a[i].y=read(),a[i].pos=i;
    sort(a+1,a+m+1,cmp);
    for(int i=1;i<=m;i++){
        int l=7;
        int num=a[i].x;
        while(num) b[a[i].pos][--l]=num%10,num=num/10;
        if (a[i].x!=a[i-1].x) sum=1;
        else sum++;
        int nowsum=sum;
        l=13;
        while(nowsum) b[a[i].pos][--l]=nowsum%10,nowsum=nowsum/10;
    }
    for(int i=1;i<=m;i++){
        for(int j=1;j<=12;j++)
            printf("%d",b[i][j]);
        printf("\n");
    }
    return 0; 
}


Measured memory_bytes: 13952
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		char c[]=in.next().toCharArray();
		int K=0;
		int U=0;
		int P=0;
		int C=0;
		int ans=0;
		for(int i=0; i<c.length;i++)
		{
			if(c[i]=='K')
				K++;
			if(c[i]=='U')
				U++;
			if(c[i]=='P')
				P++;
			if(c[i]=='C')
				C++;
		}
		while(K-->0&&U-->0&&P-->0&&C-->0)
			ans++;
		System.out.println(ans);
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int sum=0,sign=1;
	char c=getchar();
	while(!isdigit(c))
	{
		if (c=='-') sign=-1;
		c=getchar();
	}
	while(isdigit(c))
	{
		sum=(sum<<1)+(sum<<3)+c-'0';
		c=getchar();
	}
	return sum*sign;
}
#define read(x) x=read()
const int N=3005;
int n,m;
int map1[N][N];
int f[N][N];
int h[N];
int st[N];
int p[N];
int main()
{
	read(n),read(m);
	for (int i=1;i<=n;++i)
	{
	  for (int j=1;j<=m;++j)
	  {
	  	char c=getchar();
	  	map1[i][j]=c=='#'?1:0;
	  }		
	  getchar();
	}
    for (int i=1;i<n;++i)
      for (int j=1;j<m;++j)
        {
        	int t=0;
        	for (int i1=i;i1<=i+1;++i1)
        	  for (int j1=j;j1<=j+1;++j1)
        	    t+=map1[i1][j1];
        	if(t%2==0) f[i][j]=1;
		}
   int ans=max(n,m);
   for(int i=1;i<n;++i)
   {
        for(int j=1;j<m;++j)
          if (f[i][j]==1) ++h[j];
          else h[j]=0;
        int r=0;
		memset(st,0,sizeof(st));
        memset(p,0,sizeof(p));
        for(int j=1;j<=m;++j)
		{
            while(r>0&&st[r]>=h[j])
                ans=max(ans,(st[r]+1)*(j-p[r-1])),--r;
            st[++r]=h[j],p[r]=j;
        }
    }
	printf("%d",ans);
}

Measured memory_bytes: 49408
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    cin>>x>>y;
    if(x<y){
        cout<<"a < b"<<endl;
    }else if(x>y){
        cout<<"a > b"<<endl;
    }else{
        cout<<"a == b"<<endl;
    }
}



Measured memory_bytes: 3088
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
long long int inf = 1e18;

int main() {

  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];
  for(int i=0; i<n; i++) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  long long int cnt = 0;
  for(int i=0; i<n; i++){
    long long int ta = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    long long int tc = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
    cnt += ta*tc;
  }
  cout << cnt << endl;

  return 0;
}




//


Measured memory_bytes: 1536
package main

import (
	"fmt"
)

func main() {
	var a [2]int
	fmt.Scan(&a[0], &a[1])

	x := a[0] + a[1]

	if x%2 == 1 {
		fmt.Printf("IMPOSSIBLE")
	} else {
		fmt.Println(x / 2)
	}
}


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

typedef long long LL;

LL A, B, N;

int main() {
	
	std :: cin >> N >> A >> B;

	if(A * B < N || A + B - 1 > N) return puts("-1"), 0;

	while(N) {
		int x = std :: min(N - B + 1, A);
		for(LL i = N - x + 1; i <= N; i++) printf("%lld ", i);
		N -= x; B--;
	}

	std :: cout << std :: endl;

	return 0;
}


Measured memory_bytes: 2176
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int D=1e9+7;
const int MAXN=18,MAXS=70000;
int n,m,a[MAXN],cnt[MAXS];
ll f[MAXN][MAXS];
ll qpow(ll x,ll k) {
	ll ret=1;
	while(k) {
		if(k&1) ret=ret*x%D;
		x=x*x%D;
		k>>=1;
	}
	return ret;
}

ll fac[MAXS+233],inv[MAXS+233];
void first(int lim) {
	fac[0]=inv[0]=1;
	for(int i=1;i<=lim;i++) fac[i]=fac[i-1]*i%D;
	inv[lim]=qpow(fac[lim],D-2);
	for(int i=lim-1;i;i--) inv[i]=inv[i+1]*(i+1)%D;
}
ll C(int x,int y) {
	if(y>x) return 0;
	return fac[x]*inv[x-y]%D*inv[y]%D;
}

void upt(ll &x,ll y) {
	x=(x+y)%D;
}
int main() {
	first(70000);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	sort(a+1,a+m+1);
	f[m+1][0]=1;
	for(int i=m;i;i--) {
		for(int s=0;s<(1<<n);s++) if(f[i+1][s]) {
			upt(f[i][s],f[i+1][s]);
			int cnt=(1<<n)-a[i]-s;
			for(int j=0;j<n;j++) if(!((1<<j)&s)) {
				int ss=s|(1<<j);
				upt(f[i][ss],f[i+1][s]*C(cnt,(1<<j)-1)%D*fac[1<<j]);
			}
		}
	}
	ll ans=0;
	cnt[0]=1;
	for(int i=1;i<(1<<n);i++) cnt[i]=-cnt[i-(i&-i)];
	for(int s=0;s<(1<<n);s++)
		ans=(ans+cnt[s]*f[1][s]*fac[(1<<n)-s-1])%D;
	ans=ans*(1<<n)%D;
	printf("%lld\n",(ans+D)%D);
	return 0;
}

Measured memory_bytes: 10240
#include<stdio.h>
int main(void) 
{
	int N, R;
	scanf("%d", &N);
	scanf("%d", &R);
	if (N >= 10)printf("%d", R);
	if (N < 10) {
		R = R + 100 * (10 - N);
		printf("%d", R);
	}
	return 0;
}


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

int b[2][114514], f[2][114514];

bool used[114514];

signed main(){
  int n;
  int mod = 10007;
  while(cin >> n, n) {
    memset(b, -1, sizeof(b));
    memset(f, -1, sizeof(f));
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < 2; j++) cin >> b[j][i] >> f[j][i];
    }
    memset(used, false, sizeof(used));
    int ans = 1;
    for(int i = 0; i < n; i++) {
      if(used[i]) continue;
      set<int> st;
      queue<int> que;    
      que.push(i);
      while(!que.empty()) {
	int u = que.front(); que.pop();
	if(used[u]) continue;
	used[u] = true;
	st.insert(u);
	que.push(b[0][u]);	
	que.push(b[1][u]);
      }
      map<int, int> m;
      for(int j : st) {
	m[f[0][j]]++;
	m[f[1][j]]++;
      }
      auto it = m.end(); it--;
      (ans *= it->second/2) %=  mod;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 7252
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int>>
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long>>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1){
            res=res*x;
            if(res>MOD)res=MOD;
        }
        y>>=1;
        x=x*x;
        if(x>MOD)x=MOD;
    }
    return res;
}
int res[SIZE];
void print2(int sub,int K,int N){
    REP(i,N)res[i]=K;
    res[0]=(K+1)/2-1;
    while(sub--){
        int it=N-1;
        while(!res[it])it--;
        res[it]--;
        if(res[it])
            REPP(i,it+1,N)res[i]=K;
    }
    int it=N-1;
    while(it>=0&&!res[it])it--;
    REP(i,it+1)printf("%d ",res[i]);
}
void print(int add,int K,int N){
    LL tmp=0;
    for(int i=N-1;i>=0;i--){
        tmp+=mypow(K,i);
        if(tmp>add+2)break;
    }
    if(tmp>add){
        printf("%d ",(K+1)/2);
        if(tmp==add+1||tmp==add+2)return;
        print(add+1,K,N-1);
    }
    else{
        print2((add-tmp)/2,K,N);
    }
}
int main(){
    DRII(K,N);
    if(K==1){
        REP(i,(N+1)/2)printf("1 ");
        puts("");
        return 0;
    }
    else if(K%2==0){
        printf("%d",K/2);
        REPP(i,1,N)printf(" %d",K);
        puts("");
        return 0;
    }
    print(0,K,N);
    puts("");
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int a;
  int b;
  int X = 0;
  vector<int> P(N);
  for(int i=0; i<N; i++) cin >> P.at(i);
  for(int i=0; i<N-1; i++){
    a = P.at(i);
    for(int j=0; j<N-1-i; j++){
      b = P.at(i+1+j);
      X += a*b;
    }
  }
  cout << X << endl;
        
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int m = Integer.parseInt(std.next());

		int matrix[][] = new int[n][m];
		for(int i=0; i<=n-1; i++){
			for(int j=0; j<=m-1; j++){
				matrix[i][j] = Integer.parseInt(std.next());
			}
		}

		int vector[] = new int [m];
		for(int k=0; k<=m-1; k++){
			vector[k] = Integer.parseInt(std.next());
		}

		for(int i=0; i<=n-1; i++){
			int ans = 0;
			for(int j=0; j<=m-1; j++){
				ans += matrix[i][j] * vector[j];
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 38588
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	string s;
	cin>>s;
	int c=0,m=0;
	for0(i,s.size()){
		if(s[i]!='A' && s[i]!='C' && s[i]!='G' && s[i]!='T'){
			m = max(m,c);
			c=0;
			}
		if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T') c++;
		}
	m = max(c,m);
	cout<<m<<nw;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
As = list(map(int,input().split()))
Q = int(input())

lst = [0] * (10**5+1)
for A in As:
    lst[A] += 1

val = sum(As)

vals = []
for i in range(Q):
    B, C = map(int,input().split())
    val += (C-B) * lst[B]
    lst[C] += lst[B]
    lst[B] = 0
    vals.append(val)
for val in vals:
    print(val)

Measured memory_bytes: 21052
from scipy.special import comb
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
x = 0

for c in C.values():
    x += comb(c, 2, exact=True)

for i in range(N):
    y = x - comb(C[A[i]], 2, exact=True) + comb(C[A[i]] - 1, 2, exact=True)
    print(y)


Measured memory_bytes: 66240
#pragma region
#include <bits/stdc++.h>	
#define pb push_back
typedef long long ll;
const int inf = 2e9;
using namespace std;
#pragma endregion


int n,m,ans=0,t,b=0;

bool ord(int a, int b){
	return a>b;
}

vector<int> v;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
 
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
}


int main()
{
    
    scanf("%d",&n);
    SieveOfEratosthenes(55555);

    vector<int> ans;

    for (int i = 0; i < v.size(); ++i)
    {
    	if(v[i]%5==1) ans.pb(v[i]);
    }

    if(ans.size()>=n){
    	for (int i = 0; i < n; ++i)
    	{
    		cout<<ans[i]<<" ";
    	}
    	return 0;
    }



    
    return 0;
    
       
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>
#include<iomanip>//小数点以下を精度良く表示

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define INF2 1000000000000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<string, string> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;



const int MAX_N = 1000;
const int MAX_K = 100000;

template<class T>  T gcd(T a, T b) {
    while (a % b != 0) {
        T tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

template<class T> T lcm(T a, T b) {
    if (a == b) return b;
    T g = gcd(a, b);
    return (a / g) * b;
}
int k;

int main() {
    cin >> k;
    ll res = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                res += gcd(a, gcd(b, c));
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			A();
		}

		public static void A()
		{
			Scanner cin = new Scanner();
			int a = cin.NextInt();
			int b = cin.NextInt();
			int c = cin.NextInt();
			int d = cin.NextInt();
			int e = cin.NextInt();
			int k = cin.NextInt();

			if (e - a <= k) {
				Console.Write("Yay!");
			} else {
				Console.Write(":(");
			}
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#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 repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll>a;
  function<void(ll,bitset<8>)>dfs=[&](ll num,bitset<8>bit){
    //cout<<num<<endl;
    if(bit==(1ll<<n)-1){
      a.push_back(num);
      return;
    }
    repi(i,1,n+1){
      if(bit[i-1])continue;
      auto tb=bit;
      tb[i-1]=1;
      dfs(num*10+i,tb);
    }
    return ;
  };
  ll p=0,q=0;
  rep(i,n){
    ll a;cin>>a;
    p=p*10+a;
  }
  rep(i,n){
    ll a;cin>>a;
    q=q*10+a;
  }
  dfs(0,0);
  sort(all(a));
  ll res=0;
  res=(lower_bound(all(a),p)-a.begin())-(lower_bound(all(a),q)-a.begin());

  cout<<abs(res)<<endl;
  return 0;

}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
const int M = 1e5+7;
int arr[M], dp[M];
int n, k;

bool solve(int x)
{
	if (dp[x]!= -1)
	return dp[x];

	if (k == 0) return dp[k] = 0;
	int ans = 0;
	for(int i = 0; i < n; i++)
	{
		if (arr[i] > x)
		continue;
		if (solve(x-arr[i]) == 0)
		{
			ans = 1;
			break;
		}
	}

	return dp[x] = ans;
}

int main()
{
	
	cin >> n >> k;
	memset(dp, -1, sizeof(dp));

	for(int i = 0; i < n; i++)
	cin >> arr[i];

	if (solve(k))
	cout << "First" << endl;
	else
	{
		cout << "Second" << endl;
	}
		

	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,ans;
    cin>>a;
    ans= a+a*a+a*a*a;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int c[4][4];
  for(int i=1;i<=3;i++){
    for(int j=1;j<=3;j++) cin >> c[i][j];
  }

  if(c[1][1]-c[1][2]!=c[2][1]-c[2][2] || c[1][1]-c[1][2]!=c[3][1]-c[3][2]){
    cout << "No" << endl;
    return 0;
  }
  if(c[1][1]-c[1][3]!=c[2][1]-c[2][3] || c[1][1]-c[1][3]!=c[3][1]-c[3][3]){
    cout << "No" << endl;
    return 0;
  }
  if(c[1][1]-c[2][1]!=c[1][2]-c[2][2] || c[1][1]-c[2][1]!=c[1][3]-c[2][3]){
    cout << "No" << endl;
    return 0;
  }
  if(c[1][1]-c[3][1]!=c[1][2]-c[3][2] || c[1][1]-c[3][1]!=c[1][3]-c[3][3]){
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int gcd(int x,int y)
{
if(y==0){
return x;
}else{
return gcd(y,x%y);
}
}

int main(void)
{
int n;
int b,c,i;
int a[3]={0};

scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
b=gcd(a[0],gcd(a[1],a[2]));
for(i=1;i<=b;i++){
if(b%i==0){
printf("%d\n",i);
}
}
return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(c >= a && c <= b){
        cout << "Yes" << '\n';
    }
    else{
        cout << "No" << '\n';
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from functools import lru_cache

@lru_cache()
def F(N):
  if N < 10:
    return N
  q,r = divmod(N, 10)
  x1 = F(q) + r
  x2 = F(q-1) + 9
  return max(x1, x2)

answer = F(int(input()))
print(answer)

Measured memory_bytes: 3572
import sys
input = sys.stdin.readline
from collections import Counter, deque

INF = float('inf')

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""


def main():
    R = int(input())
    print(R ** 2)


if __name__ == '__main__':
    main()


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
int S[22];
int D[111];

int latte[1<<15];
int dp[1<<15];

signed main(){
    while(cin>>N>>M,N||M){
        rep(i,N)cin>>S[i];
        rep(i,M)cin>>D[i];
        sort(D,D+M);
        memset(latte,0,sizeof(latte));
        rep(i,1<<N)rep(j,N)if(i>>j&1)latte[i]+=S[j];
        memset(dp,0,sizeof(dp));
        for(int j=0;j<M;j++){
            for(int i=0;i<(1<<N);i++){
                dp[i]+=abs(latte[i]-D[j]);
                for(int k=0;k<N;k++)if(i>>k&1)chmin(dp[i],dp[i^(1<<k)]);
            }
        }
        cout<<dp[(1<<N)-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3532
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()] 

A_minus = []
A_plus = []

for i in range(N):
    A_plus.append(i+A[i])
    A_minus.append(i-A[i])

A_plus.sort()
A_minus.sort()

tot = 0
index = 0

a_prev = A_plus[0]
A_plus_map = {}
A_plus_map[a_prev] = 1
for i in range(1,N):
    a = A_plus[i]
    if a == a_prev:
        A_plus_map[a] += 1
    else:
        A_plus_map[a] = 1
        a_prev= a



a_prev = A_minus[0]
A_minus_map = {}
A_minus_map[a_prev] = 1
for i in range(1,N):
    a = A_minus[i]
    if a == a_prev:
        A_minus_map[a] += 1
    else:
        A_minus_map[a] = 1
        a_prev= a


tot = 0
for key in A_plus_map.keys():
    val = A_plus_map[key]
    if key in A_minus_map.keys():
        tot += val * A_minus_map[key]

print(tot)





Measured memory_bytes: 152348
#include <bits/stdc++.h>
 
using namespace std;
   
#define debug cout<<"???"<<endl
#define sync std::ios::sync_with_stdio(false)
#define ll long long
#define pb push_back
#define mp make_pair
#define maxn 100005
#define INF 0x3f3f3f3f
#define frein freopen("input.txt", "r", stdin)
#define freout freopen("output.txt", "w", stdout)
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%lld", (x))
struct node{
	int n;
	int c, s;
}p[15];
int dp[15][2005];
int check(int v, int n, int g) {
	memset(dp, 0, sizeof(dp));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= v; j++) {
			for (int k = 0; k <= p[i].n; k++) {
				if (j - k >= 0) {
					int cur = dp[i - 1][j - k] + k * i * 100;
					if (k == p[i].n) cur += p[i].c;
					dp[i][j] = dp[i][j] > cur ? dp[i][j] : cur;
				}
				else {
					break;
				}
			}
		}
	}
	if (dp[n][v] >= g) return 1;
	else return 0;
}
int main()
{
     //sync 
	 //frein
     //freout
     int n, sum = 0;
     int g;
     sc(n);
     sc(g);
     for (int i = 1; i <= n; i++) {
     	sc(p[i].n);
     	sc64(p[i].c);
     	sum += p[i].n;
	 }
	 int l = 0, r = sum, ans = sum;
	 while (l < r) {
	 	int mid = (l + r) / 2;
	 	//printf("%d %d %d\n", l, r, mid);
	 	if (check(mid, n, g)) {
	 		ans = mid;
	 		r = mid;
		 }
	 	else l = mid + 1;
	 //	printf("%d %d %d", l, r, mid);
	 }
	 pr(ans);
     return 0;
}

Measured memory_bytes: 384
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
P = tuple(map(int, sys.stdin.buffer.readline().split()))
Q = tuple(map(int, sys.stdin.buffer.readline().split()))

p = -1
q = -1
for i, c in enumerate(list(itertools.permutations(range(1, N + 1)))):
    if c == P:
        p = i
    if c == Q:
        q = i
print(abs(p - q))


Measured memory_bytes: 46064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<long long> vals(n);
	const long long inf = 1ll<<60;
	const int magic = 4;
	vector<vector<long long> > f(magic + 1, vector<long long>(n + 1, -inf));
	vector<char> sig(n + 1, '+');
	cin >> vals[0];
	for(int i = 1; i < n; i++){
		cin >> sig[i] >> vals[i];
	}
	f[0][0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < magic; j++){
			int csig = j%2 == 0?1:-1;
			if(sig[i] == '-'){
				f[j][i+1] = max(f[j][i+1], f[j][i] - csig * vals[i]);
				if(j) f[j-1][i+1] = max(f[j-1][i+1], f[j][i] - csig * vals[i]);
				f[j+1][i+1] = max(f[j+1][i+1], f[j][i] - csig * vals[i]);
			} else {
				f[j][i+1] = max(f[j][i+1], f[j][i] + csig * vals[i]);
				if(j) f[j-1][i+1] = max(f[j-1][i+1], f[j][i] + csig * vals[i]);
			}
		}
	}
	cout << f[0][n] << endl;
	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  ll a,b;
  cin >> a >> b;
  if((a+b)%2==0)cout << abs((a+b)/2) << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int x;
	cin>>x;
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			if(i*j==x)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

#define EPS 0.0002

struct Point{double x,y,z;};
double getDistance(Point p1,Point p2)
{
  return sqrt(pow(p1.x-p2.x,2.0)+pow(p1.y-p2.y,2.0)+pow(p1.z-p2.z,2.0));
}

int main()
{
  int n,m,P,Q,R;
  double original[3],x,y,z;
  int i,j,k,l;
  cin>>n;
  while(n-->0){
    for(i=0;i<3;i++)cin>>original[i];

    cin>>m;
    vector<Point>v(m);
    for(i=0;i<m;i++){
      cin>>x>>y>>z;
      Point p={x,y,z};
      v[i]=p;
    }

    P=0;
    for(i=0;i<m;i++){
      for(j=0;j<m;j++){
	if(i==j)continue;
	for(k=0;k<m;k++){
	  if(i==k||j==k)continue;
	  Point p[3]={v[i],v[j],v[k]};
	  bool ok=true;
	  double d[3]={getDistance(p[1],p[2]),getDistance(p[2],p[0]),getDistance(p[0],p[1])};
	  for(int s=0;s<3;s++){
	    for(int t=0;t<3;t++){
	      if(original[s]/original[t]-d[s]/d[t]>EPS)ok=false;
	    }
	  }
	  if(ok){
	    P=i+1;
	    Q=j+1;
	    R=k+1;
	  }
	  if(P)break;
	}
	if(P)break;
      }
      if(P)break;
    }

    cout<<P<<" "<<Q<<" "<<R<<endl;
  }
}

Measured memory_bytes: 968
#include <iostream>
 #include <vector>
 #include <map>
 #include <string>
 #include <algorithm>
 using namespace std;

 typedef long long ll;



 int main()
 {
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n);
    for(int i = 0; i < n+ 1; i++)
    {
        cin >> a.at(i);
    }

    for(int i = 0; i < n; i++)
    {
        cin >> b.at(i);
    }

    ll ans = 0;

    for(int i = 0; i < n; i++)
    {
        int left = min(a.at(i), b.at(i));
        ans += left;
        a.at(i) -= left;
        b.at(i) -= left;

        int right = min(b.at(i), a.at(i+1));
        ans += right;
        a.at(i+1) -= right;
    }

    cout << ans << endl;
    
     return 0;
 }

Measured memory_bytes: 1024
//package codeforces;

import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.TreeMap;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

import java.util.Stack;

public class Main {
	static Scanner scn = new Scanner(System.in);
	static long cunt = 0;

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static FastReader s = new FastReader();

	public static void main(String[] args) throws IOException {
		/* TODO Auto-generated method stub*/
		// System.out.format("%.10f", ans);char c = sc.next().charAt(0);
		int t=scn.nextInt();
		if(t%2==0)
			System.out.println(t/2);
		else
			System.out.println(t/2+1);
	}
	

	public static String factorial(int n) {
		BigInteger fact = new BigInteger("1");
		for (int i = 1; i <= n; i++) {
			fact = fact.multiply(new BigInteger(i + ""));
		}
		return fact.toString();
	}

	public static int bs(int arr[], int k) {
		int high = 0, low = Integer.MIN_VALUE, ans = 0;
		for (int i = 0; i < arr.length; i++) {
			high += arr[i];
			if (arr[i] > low)
				low = arr[i];
		}
		while (low <= high) {
			int mid = (high + low) / 2;
			if (valid(arr, mid, k)) {
				ans = mid;
				high = mid - 1;
			} else
				low = mid + 1;
		}
		return ans;
	}

	public static boolean valid(int arr[], int mid, int k) {
		int sum = 0, cs = 1;
		for (int i = 0; i < arr.length; i++) {
			if (sum + arr[i] > mid) {
				cs++;
				if (cs > k)
					return false;
				sum = arr[i];
			} else
				sum += arr[i];
		}
		return true;
	}

	public static long gcd(long a, long n) {

		if (a == 0)
			return n;
		return gcd(n % a, a);
	}

}


Measured memory_bytes: 22868
/**
 * ??????????????????????????£?????????
 * ?????????????????????????????? l[], r[] ????????????????????????????????§??????
 * ??????????????????????????? r[] ??????????´?????????????????????¨????????????????????§??? l[]
 * ??????????????°??????????????°??¨???????????????????????????
 *
 * ???????????????????????????????????´???????????°??? n*(n-1)/2 ??¨??????????????§??¨??????
 * n == 200000 ?????¨???11???????????£??? 32bit ??§????¶?????????????????????§??¨???
 */

#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

void read_problem(vector<int>& ary)
{
    int n;
    scanf("%d\n", &n);

    ary.resize(n);
    REP(i, n) {
        scanf("%d", &ary[i]);
    }
}

uint64_t cnt = 0;

void merge(vector<int>& ary, int start, int mid, int end)
{
    constexpr int INF = numeric_limits<int>::max();

    vector<int> l(ary.begin() + start, ary.begin() + mid);
    vector<int> r(ary.begin() + mid,   ary.begin() + end);
    int n1 = l.size();
    int n2 = r.size();
    l.push_back(INF);
    r.push_back(INF);

    int i = 0;
    int j = 0;
    FOR(k, start, end) {
        if(l[i] <= r[j]) {
            ary[k] = l[i++];
        }
        else {
            cnt += n1 - i;
            ary[k] = r[j++];
        }
    }
}

void mergesort(vector<int>& ary, int start, int end)
{
    if(end - start >= 2) {
        int mid = (start + end) / 2;
        mergesort(ary, start, mid);
        mergesort(ary, mid,   end);
        merge(ary, start, mid, end);
    }
}

int main()
{
    vector<int> ary;
    read_problem(ary);

    mergesort(ary, 0, ary.size());

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

    return 0;
}

Measured memory_bytes: 4684
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;





int main() {
  int N;
  cin >> N;
  long power = 1;
  long split = 1000000007;
  for (int i = 1; i <= N; i++) {
    power *= i;
    if (power > split) power %= split;
  }
  cout << power << endl;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 //Code
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;

const int N = 3e5 + 123;

int n, m, k;
vector < pii > gr[N];
int a[N];
int dp1[N] , cnt1[N], dp2[N], cnt2[N] , w[N] , v[N] , u[N];

main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int s , t;
	cin >> n >> m >> s >> t;

	rep(i , 1 , n)
		dp1[i] = dp2[i] = 1e17;
	dp1[s] = dp2[t] = 0;
	cnt1[s] = cnt2[t] = 1;
	
	for(int i = 1; i <= m; i++){
		cin >> u[i] >> v[i] >> w[i];
		gr[u[i]].pb({v[i],w[i]});
		gr[v[i]].pb({u[i],w[i]});
	}
	set < pii > st;
	st.insert({0 , s});
	
	while(sz(st) != 0){
		int u = (*st.begin()).se;
		st.erase(st.begin());
		for(auto to : gr[u]){
			if(dp1[to.fi] == dp1[u] + to.se)
				cnt1[to.fi] += cnt1[u], cnt1[to.fi] %= mod;
			else if(dp1[to.fi] > dp1[u] + to.se){
				st.erase({dp1[to.fi] , to.fi});
				dp1[to.fi] = dp1[u] + to.se;
				cnt1[to.fi] = cnt1[u];
                st.insert({dp1[to.fi],to.fi});
			}
		}
	}    

	st.insert({0 , t});
	while(sz(st) != 0){
		int u = (*st.begin()).se;
		st.erase(st.begin());
		for(auto to : gr[u]){
			if(dp2[to.fi] == dp2[u] + to.se)
				cnt2[to.fi] += cnt2[u] , cnt2[to.fi] %= mod;
			else if(dp2[to.fi] > dp2[u] + to.se){
				st.erase({dp2[to.fi] , to.fi});
				dp2[to.fi] = dp2[u] + to.se;
				cnt2[to.fi] = cnt2[u];
                st.insert({dp2[to.fi],to.fi});
			}
		}
	}	
	int tot = cnt1[t] * cnt1[t]%mod;
	for(int i = 1; i <= m; i++){
		if(dp1[u[i]] + dp2[v[i]] > dp2[u[i]] + dp1[v[i]])
			swap(u[i],v[i]);
		if(dp1[u[i]] + dp2[v[i]] + w[i] == dp1[t]){
			int l = max(dp1[u[i]],dp2[v[i]]) , r = min(dp1[u[i]],dp2[v[i]])+w[i];
			if(l < r)
				tot -= cnt1[u[i]] * cnt2[v[i]] % mod * cnt1[u[i]] % mod * cnt2[v[i]] % mod , tot += mod , tot %= mod;
		}
	}

	for(int i = 1; i <= n; i++)
		if(dp1[i] + dp2[i] == dp1[t] and dp1[i] == dp2[i])
			tot -= cnt1[i] * cnt2[i] % mod * cnt1[i] %mod * cnt2[i] % mod , tot += mod , tot %= mod;


	ret(tot);
        
}

Measured memory_bytes: 39024
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int temp=k;
		int c=0;
		while(temp<=n) {
			temp*=k;
			c++;
		}
		System.out.println(c+1);
	}
}

Measured memory_bytes: 21844