akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>

using namespace std;

bool isPalindrome(string s)
{
	int n = s.size();
	for (int i = 0; i < n / 2; ++i)
	{
		if (s[i] != s[n - i - 1])
		{
			return(false);
		}
	}
	return(true);
}

void solve()
{
	string temp;
	while (getline(cin, temp))
	{
		string str;
		for (int i = 0; i < temp.size(); ++i)
		{
			if ('a' <= temp[i] && temp[i] <= 'z')
			{
				str += temp[i] - 'a' + 'A';
			}
			if ('A' <= temp[i] && temp[i] <= 'Z')
			{
				str += temp[i];
			}
		}
		int n = str.size();
		vector<string> palindrome;
		set<string> bad;
		deque< deque<bool> > flag(n, deque<bool>(n));
		for (int i = n; i >= 3; --i)
		{
			for (int j = 0; j <= n - i; ++j)
			{
				if (flag[j][j + i - 1])
				{
					continue;
				}
				string sub;
				for (int k = j; k < j + i; ++k)
				{
					sub += str[k];
				}
				if (isPalindrome(sub) && bad.find(sub) == bad.end())
				{
					palindrome.push_back(sub);
					for (int k = 0; k < i / 2; ++k)
					{
						flag[j + k][j + i - k - 1] = true;
						string tmp;
						for (int l = k; l < i - k; ++l)
						{
							tmp += sub[l];
						}
						bad.insert(tmp);
					}
				}
			}
		}
		bool isFirst = true;
		for (int i = 0; i < palindrome.size(); ++i)
		{
			if (!isFirst)
			{
				cout << " ";
			}
			cout << palindrome[i];
			isFirst = false;
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, ans=0;
  cin >> N;
  vector<int> B(N-1);
  REP(i,N-1) cin >> B[i];
  REP(i,N-1) {
    ans+=B[i]*2;
    if(i>0) {
      if(B[i]>=B[i-1]) ans-=B[i];
      else ans-=B[i-1];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def readdata():
    x = []
    try:
        while True:
            x.append(map(int,raw_input().split(",")))
    except: return x

def checkhand2(hand):
    tmp = [(e+11)%13 for e in hand]
    x1=sorted(list(set(tmp)))
    x2=[]
    for e in x1:
        x2.append(tmp.count(e))
    return x1,x2

def isstraight(x1):
    if x1==[0,1,2,3,12]: return True
    e = x1[0]
    if x1==range(e,e+5): return True
    else: return False

def checkhand(hand):
    x1,x2 = checkhand2(hand)
    x2 = sorted(x2)
    prize = 0
    if x2==[1,1,1,1,1]:
        if isstraight(x1): prize = 4
        else: prize = 0
    elif x2==[1,1,1,2]: prize = 1
    elif x2==[1,2,2]: prize = 2
    elif x2==[1,1,3]: prize = 3
    elif x2==[2,3]: prize = 5
    elif x2==[1,4]: prize = 6
    return prize

values=[2,3,4,5,6,7,8,9,10,11,12,13,1]
prize=["null","one pair","two pair","three card",
        "straight","full house","four card"]

hands = readdata()
for e in hands:
    print prize[checkhand(e)]

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

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int D;
    string answer = "Christmas";
    cin >> D;
    if (D == 24) answer += " Eve";
    if (D == 23) answer += " Eve Eve";
    if (D == 22) answer += " Eve Eve Eve";
    cout << answer << endl;
    return 0;
}

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

using namespace std;

int main()
{cin.tie(0);ios_base::sync_with_stdio(0);
 int n;
 cin>>n;
 string s;
 cin>>s;
 if(n<3200)
   cout<<"red\n";
 else
   cout<<s<<"\n";
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    long long int a,b,x,y,z,st;
     
    while(cin >> a >> b,a,b){
        x=max(a,b);
        y=min(a,b);
        st=0;
        while(1){
            if(y==0) break;
            z=x%y;
            x=y;
            y=z;
            st++;
        }
        cout << x << ' ' << st << endl;
    }
     
    return 0;
}

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

int main()
{

	int a[100][100] = {0},b[100][100] = {0};
	long c[100][100] = {0};

	int n, m, l;
	cin >> n >> m >> l;

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

	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			cin >> b[i][j];
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			for(int k = 0; k < m; k++){
			c[i][j] += a[i][k] * b[k][j];
			}

		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			cout << c[i][j];
			if(j < l - 1){
				cout << ' ';
			}
		}
		cout << endl;
	}
	

	return 0;
}

Measured memory_bytes: 1324
#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	int k;
	cin >> k;
	ll sum = 0;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= k; j++) {
			for (int z = 1; z <= k; z++) {
				ll x = gcd(i, j);
				ll y = gcd(x, z);
				sum += y;
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>

using namespace std;

using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

int main(int argc, char* argv[]) {
  i64 A, B;
  cin >> A >> B;
  for(i64 i=1; i <= B; ++i) {
    if((A*i) % B == 0) {
      cout << A*i << endl;
      break;
    }
  }
  return 0;
}

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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
 vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x;
 while (getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
 template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}
//

int T;
const int N = 2e5 + 10;
int a[N];
int n;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    while (cin >> n)
    {
        int ans = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            if (i % 2 == 1 && a[i] % 2 == 1) ans++;
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int r,c,a[111][111],k[101],sum=0,ans=0;
  cin >> r >> c;
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      cin >>  a[i][j];
      sum=sum+a[i][j];
      a[r][j]=a[r][j]+a[i][j];
      ans=a[r][j]+ans;
    }
    a[i][c]=sum;
    a[r][c]=ans;
    sum=0;
    ans=0;
  }
  for(int i=0;i<=r;i++){
    for(int j=0;j<=c;j++){
      cout << a[i][j];
      if(j!=c){
	cout << " ";
      }else{
	cout << "\n";
      }
    }
  }
  return(0);
}



Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var EY = ReadInts();
            var E = EY[0];
            var Y = EY[1];


            if (E == 0)
            {
                //西暦
                if (1868 <= Y && Y <= 1911)
                {
                    WriteLine("M" + (Y - 1868 + 1));
                }
                else if (1912 <= Y && Y <= 1925)
                {
                    WriteLine("T" + (Y - 1912 + 1));

                }
                else if (1926 <= Y && Y <= 1988)
                {
                    WriteLine("S" + (Y - 1926 + 1));

                }
                else if (1989 <= Y && Y <= 2016)
                {
                    WriteLine("H" + (Y - 1989 + 1));
                }
            }
            else if (E == 1)
            {
                //明治
                WriteLine(1868 + Y - 1);
            }
            else if (E == 2)
            {
                //大正
                WriteLine(1912 + Y - 1);
            }
            else if (E == 3)
            {
                //昭和
                WriteLine(1926 + Y - 1);
            }
            else
            {
                //平成
                WriteLine(1989 + Y - 1);

            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 17912
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

void do_calc(int a, int b){
  int c = a + b;
  int n = 0;
  while(true){
    if(c < 1.0f){
      cout << n << endl;
      break;
    }
    c = c/10;
    n++;
  }
}
  


int main(){
  int a, b;
  while(cin >> a >> b){
    do_calc(a, b);
  }
}

Measured memory_bytes: 1160
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
int main()
{
    int n , m;
    cin >> n >> m ;
    cout << (n*(n-1))/2 + (m*(m-1))/2 <<"\n"; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 305
#define MOD 998244353
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char S[SIZE];
int dp[SIZE][SIZE];
int C[SIZE][SIZE];
int r0[SIZE],r1[SIZE];

void make()
{
	for(int i=0;i<SIZE;i++)
	{
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;j++)
		{
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			if(C[i][j]>=MOD) C[i][j]-=MOD;
		}
	}
}
int main()
{
	make();
	scanf("%s",&S);
	int n=strlen(S);
	//int n=300;
	//for(int i=0;i<n;i++) S[i]='0'+(i%2);
	for(int i=0;i<n;i++)
	{
		r0[i]=S[i]=='0';
		r1[i]=S[i]=='1';
		if(i>0)
		{
			r0[i]+=r0[i-1];
			r1[i]+=r1[i-1];
		}
	}
	memset(dp,-1,sizeof(dp));
	dp[0][0]=0;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(dp[i][j]==-1) continue;
			if(dp[i][j]>=n-1) dp[i][j]=dp[i+1][j]=dp[i][j+1]=n;
			else
			{
				int v=dp[i][j];
				if(S[v]!=S[v+1])
				{
					dp[i+1][j]=max(dp[i+1][j],v+2);
					dp[i][j+1]=max(dp[i][j+1],v+2);
				}
				else if(S[v]=='0')
				{
					dp[i+1][j]=max(dp[i+1][j],v+2);
					if(j+1<=r1[v]) dp[i][j+1]=max(dp[i][j+1],v+1);
				}
				else
				{
					dp[i][j+1]=max(dp[i][j+1],v+2);
					if(i+1<=r0[v]) dp[i+1][j]=max(dp[i+1][j],v+1);
				}
			}
		}
	}
	ll ret=MOD-1;
	for(int i=0;i<=r0[n-1];i++)
	{
		for(int j=0;j<=r1[n-1];j++)
		{
			if(dp[i][j]==-1) continue;
			int v=dp[i][j];
			int zero,one;
			int a,b;
			if(v==0)
			{
				zero=one=0;
				a=r0[n-1];
				b=r1[n-1];
			}
			else
			{
				zero=r0[v-1]-i,one=r1[v-1]-j;
				a=r0[n-1]-r0[v-1],b=r1[n-1]-r1[v-1];
			}
			int f=zero,s=one;
			if(b==0) f=0;
			if(a==0) s=0;
			for(int k=0;k<=f;k++)
			{
				for(int l=0;l<=s;l++)
				{
					ll w=C[zero+one-k-l][zero-k];
					if(b>0) w=w*(ll) C[k+b-1][b-1]%MOD;
					if(a>0) w=w*(ll) C[l+a-1][a-1]%MOD;
					ret+=w;
					if(ret>=MOD) ret-=MOD;
				}
			}
		}
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 4560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
//#define fr(i,j,k) for(int i=j;i<k;i++)
//#define f(n) fr(i,0,n)
//#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const ll mod = 1e9 + 7;
const int maxn = 2e5+5;
#include<atcoder/all>
using namespace atcoder;
void solve() {
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    for (int i = 0 ; i < m ; i++) {
        cin >> a[i] >> b[i];
    }
    scc_graph g(n);
    for (int i = 0 ; i < m ; i++) {
        g.add_edge(a[i], b[i]);
    }
    auto scc = g.scc();
    cout << scc.size() << '\n';
    for (auto &i : scc) {
        cout << i.size() <<' ';
        for (auto &j : i) {
            cout << j <<' ';
        }
        cout << '\n';
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        solve();
    }
    
}


Measured memory_bytes: 44532
#include<stdio.h>
int main()
{
  long a,b,k,diff;
  scanf("%ld%ld",&a,&b);
  k=(a+b)/(long)2;
  diff=(a+b)%(long)2;
  if(diff==0)
  {
    printf("%ld\n",k);
  }
  else
  {
    printf("IMPOSSIBLE\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  string s, t;
  cin >> s >> t;

  bool c = true;
  rep(i, s.size()) { c = (c && (s[i] == t[i])); }
  cout << (c ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int a[100000+10];
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int sum=0;
	for(int i=1;i<=n-2;i++)
	{
		for(int j=i+1;j<=n-1;j++)
		{
			for(int k=j+1;k<=n;k++)
			{
				if(a[k]<a[i]+a[j])
				{
					sum++;
				}
				else
				break;
			}
		}
	}
	cout<<sum;
} 

Measured memory_bytes: 256
#include <stdio.h>

enum {TAKAI, BON, HARA, MINE, KUBO};

int a[100000];
int state;
int cnt[5];

int getDir(i) {
	if (a[i - 1] < a[i])
		return 0;
	else if (a[i - 1] == a[i])
		return 1;
	else
		return 2;
}

void from0(int to) {
	switch (to) {
	case 0:
		break;
	case 1:
		state = 3;
		break;
	case 2:
		state = to;
		cnt[MINE]++;
		break;
	}
}

void from1(int to) {
	switch (to) {
	case 0:
		state = 0;
		break;
	case 1:
		break;
	case 2:
		state = 2;
		break;
	}
}

void from2(int to) {
	switch (to) {
	case 0:
		state = to;
		cnt[KUBO]++;
		break;
	case 1:
		state = 4;
		break;
	case 2:
		break;
	}
}

void from3(int to) {
	switch (to) {
	case 0:
		state = 0;
		cnt[HARA]++;
		break;
	case 1:
		break;
	case 2:
		state = 2;
		cnt[TAKAI]++;
		break;
	}
}

void from4(int to) {
	switch (to) {
	case 0:
		state = 0;
		cnt[BON]++;
		break;
	case 1:
		break;
	case 2:
		state = 2;
		cnt[HARA]++;
		break;
	}
}

void (*trans[])(int) = {from0, from1, from2, from3, from4};

int main(void) {
	int i;
	int n;

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

	if (n > 1) {
		state = getDir(1);
		for (i = 2; i < n; i++)
			trans[state](getDir(i));
	}

	for (i = 0; i < 5; i++)
		printf("%d%c", cnt[i], " \n"[i == 4]);

	return 0;
}


Measured memory_bytes: 988
#include <bits/stdc++.h>
typedef long double LD;
using namespace std;
inline int rd() {
	char ch=getchar(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=getchar();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=getchar();}
	return i*f;
}
deque < pair<LD,LD> > q;
const LD eps=1e-10;
inline int sgn(LD x) {return (x>eps)-(x<-eps);}
int n,L;
LD sum_v;
int main() {
	n=rd(), L=rd();
	for(int i=1;i<=n;i++) {
		LD V=rd(), t=rd(); V*=t;
		if(i==1) {printf("%.7f\n",(double)(V/t)); q.push_back(make_pair(V,t)); sum_v=V; continue;}
		LD rs=t;
		while(q.size() && q.front().second<rs) rs-=q.front().second, sum_v-=q.front().first, q.pop_front();
		if(q.size() && sgn(rs)>0) {
			LD vi=rs*(q.front().first/q.front().second);
			q.front().first-=vi; sum_v-=vi; q.front().second-=rs;
		}
		sum_v+=V; printf("%.7f\n",(double)(sum_v/L));
		while(q.size() && (q.back().first/q.back().second)>(V/t)) {
			V+=q.back().first, t+=q.back().second, q.pop_back();
		} q.push_back(make_pair(V,t));
	}
}

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





int main()
{
  long long n,l;
  cin >> n;

  l = log2(n) + 1;

  ll ans = pow(2,l) - 1;

  cout << ans << endl;



  

  

  return 0;
}


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

public class Main {
    int a, b;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        solve();
    }

    void solve() {
        // b - a = k * (k + 1) / 2 - k * (k - 1) / 2 = k
        int k = b - a;
        int ans = k * (k + 1) / 2 - b;
        System.out.println(ans);
    }

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


Measured memory_bytes: 21204
let () = Scanf.scanf "%d" @@ fun n ->
    let gen = [1;2;3;4;5;6;7;8;9] in 
    let r = gen
        |> List.map (fun y -> List.map (fun x -> x * y) gen)
        |> List.flatten
        |> List.map (fun x -> x = n)
        |> List.fold_left (||) false
    in
    if r
    then Printf.printf "Yes"
    else Printf.printf "No"


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int gcd(int a,int b){
  return b?gcd(b,a%b):a;
}

bool is_prime[1000001];
vector<int> ps[1000001];

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

  repl(i,2,1000001)is_prime[i]=true;
  for(int i=2;i<=1000000;i++){
    if(is_prime[i]){
      ps[i].push_back(i);
      for(int j=2*i;j<=1000000;j+=i){
        is_prime[j]=false;
        ps[j].push_back(i);
      }
    }
  }

  int n;
  cin>>n;
  map<int,int> cnt;
  bool ok=true;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
    for(int p: ps[a[i]]){
      cnt[p]++;
      if(cnt[p]>=2){
        ok=false;
      }
    }
  }
  if(ok){
    cout<<"pairwise coprime"<<endl;
    return 0;
  }
  ll g=a[0];
  repl(i,1,n)g=gcd(g,a[i]);
  if(g==1){
    cout<<"setwise coprime"<<endl;
  }else{
    cout<<"not coprime"<<endl;
  }

  return 0;
}


Measured memory_bytes: 66912
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int n,m,p[110000],y[110000],g[110000],d[110000],id2[110000];
inline bool cmp(int a,int b){
	return y[a]<y[b];
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,1,m) scanf("%d%d",&p[i],&y[i]);
	fo(i,1,m) g[i]=i;
	sort(g+1,g+m+1,cmp);
	fo(i,1,m) id2[g[i]]=++d[p[g[i]]];
	fo(i,1,m) printf("%06d%06d\n",p[i],id2[i]);
	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;
int x[1000001];

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n; cin >> n;
  vll a(n);

  ll g = 0;
  rep(i, n) {
    cin >> a[i];
    g = __gcd(g, a[i]);
  }

  rep(i, n) {
    rep2(j, 2, sqrt(a[i])) {
      bool d = false;
      while (a[i] % j == 0) {
        d = true;
        a[i] /= j;
      } 

      if (!d) continue;

      if (x[j]) {
        if (g == 1) cout << "setwise coprime\n";
        else cout << "not coprime\n";
        return (0);
      }
      ++x[j];
    }

    if (a[i] != 1) {
      if (x[a[i]]) {
        if (g == 1) cout << "setwise coprime\n";
        else cout << "not coprime\n";
        return (0);
      }
      ++x[a[i]];
    }
  }

  cout << "pairwise coprime\n";
  
  return (0);
}


Measured memory_bytes: 11728
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
S = str(input())
T = str()

for i in range(len(S)):
    x = ord(S[i])-ord('A')+N
    if x<=25:
        T += chr(ord('A')+x)
    else:
        T += chr(ord('A')+x-26)

print(T)

Measured memory_bytes: 41580
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<59)


signed main(){
    int t,d,l;
    while(cin>>t>>d>>l&&(t||d||l)){
        vector<int> x(t);
        rep(i,t)cin>>x[i];

        vector<int> imos(1000000,0);
        rep(i,t){
            if(x[i]>=l){
                imos[i]++;
                imos[i+d]--;
            }
        }

        rep(i,imos.size()-1)imos[i+1]+=imos[i];

        int ans = 0;
        for(int i=0;i<t-1;i++)if(imos[i]!=0)ans++;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 11688
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (int i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": ";
    printvec(tree[i]);
  }
}

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  ll N;
  cin >> N;
  vector<ll> P(N);
  rep(i, N) {
    cin >> P[i];
  }
  // printvec(P);

  map<ll, ll> mp; // number => count
  rep(i, N) {
    ll x = P[i];

    if (mp[x] > 0) {
      ll cnt = mp[P[i]];
      mp[x] = 0;
      mp[x+1] = cnt+1;
    } else {
      mp[x+1] = 1;
    }
  }

  // cout << "mp: " << endl;
  // for (auto x : mp) {
  //   cout << x.first << "=>" << x.second << endl;
  // }

  ll ma = 0;
  for (auto x : mp) {
    if (ma < x.second) {
      ma = x.second;
    }
  }

  cout << N - ma << endl;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
int v[12], n, m, K, a[12][1002], f[12], ans;
char s[1002];
void check() {
	memset(v, 0, sizeof v);
	int tot;
	v[tot = 1] = a[1][1];
	int i = 2;
	while (i <= n) {
		if (f[i - 1]) v[++tot] = a[i][1];
		else v[tot] += a[i][1];
		if (v[tot] > K) return;
		++i;
	}
	int s = tot - 1;
	for (i = 2; i <= m; ++i) {
		v[tot = 1] += a[1][i];
		int flag = 1;
		if (v[1] > K) flag = 0;
		int j = 2;
		while (j <= n) {
			if (f[j - 1]) v[++tot] += a[j][i];
			else v[tot] += a[j][i];
			if (v[tot] > K) flag = 0;
			++j;
		}
		if (flag == 0) {
			++s;
			if (s >= ans) return;
			memset(v, 0, sizeof v);
			v[tot = 1] = a[1][i];
			int j = 2;
			while (j <= n) {
				if (f[j - 1]) v[++tot] = a[j][i];
				else v[tot] += a[j][i];
				if (v[tot] > K) return;
				++j;
			}
		}
	}
	ans = std::min(ans, s);
}
void dfs(int x) {
	if (x == n) {
		check();
		return;
	}
	f[x] = 0;
	dfs(x + 1);
	f[x] = 1;
	dfs(x + 1);
}
int main() {
	std::cin >> n >> m >> K;
	for (int i = 1; i <= n; ++i) {
		std::cin >> s + 1;
		for (int j = 1; j <= m; ++j) a[i][j] = s[j] & 15;
	}
	ans = n + m - 2;
	dfs(1);
	std::cout << ans << '\n';
}


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

short dp[5001][5001];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	
	for (int i = 0; i < m; i++){
		int a, b, x;
		scanf("%d %d %d", &a, &b, &x);
		a--; b--;
		
		dp[a][b] = (short)(x + 1);
	}
	
	int cnt = 0;
	for (int i = 0; i < n; i++){
		for (int j = 0; j <= i; j++){
			cnt += !!dp[i][j];
			
			dp[i + 1][j] = max(dp[i + 1][j], (short)(dp[i][j] - 1));
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], (short)(dp[i][j] - 1));
		}
	}
	
	printf("%d\n", cnt);
	
	return 0;
}

Measured memory_bytes: 48868
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int q = scanner.nextInt();

        int[] points = new int[n];
        Arrays.fill(points, 0);

        for (int i = 0; i < q; i++) {
            int a = scanner.nextInt();
            points[a-1] += 1;
        }
        for (int point: points) {
            System.out.println(k-q+point<=0? "No": "Yes");
        }
    }
}

Measured memory_bytes: 52140
#include <bits/stdc++.h>
using namespace std;
#define P pair<int,int>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define re(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n;
    cin>>n;
    int a[n],ans=0;
    rep(i,n){
        cin>>a[i];
        ans+=a[i]-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc063/tasks/arc075_a

n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

total = sum(nums)
dp = [[False for _ in range(total + 1)] for _ in range(n + 1)]
dp[0][0] = True
for i in range(n):
    num = nums[i]
    dp[i + 1][num] = True
    for j in range(total + 1):
        if dp[i][j] and num + j <= total:
            dp[i + 1][num + j] = True

        dp[i + 1][j] = dp[i][j] or dp[i + 1][j]

for i in range(len(dp[0]))[::-1]:
    if dp[-1][i] and i % 10 != 0:
        print(i)
        break
else:
    print(0)

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n);

    rep(i, n)
    {
        if (s[i] == 'R')
            a[i] = 0;
        if (s[i] == 'G')
            a[i] = 1;
        if (s[i] == 'B')
            a[i] = 2;
    }
    vector<ll> cnt(3);
    rep(i, n) cnt[a[i]]++;
    ll ans = 1;
    rep(i, 3) ans *= cnt[i];
    for (int j = 0; j < n; j++)
    {
        for (int i = 0; i < j; i++)
        {
            int k = j + (j - i);
            if (k < n)
            {
                if (a[i] == a[j])
                    continue;
                if (a[j] == a[k])
                    continue;
                if (a[i] == a[k])
                    continue;
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i,j,n,r,p,c;
		while(true){
			n = sc.nextInt();
			r = sc.nextInt();
			if(n==0&&r==0)break;
			int[] before = new int[n];
			for(i=0;i<n;i++){
				before[i]=n-i;
			}
			int[] after = new int[n];
			for(i=0;i<r;i++){
				p=sc.nextInt();
				c=sc.nextInt();
				for(j=0;j<c;j++)after[j]=before[p-1+j];
				for(j=c;j<c+p-1;j++)after[j]=before[j-c];
				for(j=c+p-1;j<n;j++)after[j]=before[j];
				for(j=0;j<n;j++)before[j]=after[j];
			}
			System.out.println(after[0]);
		}
	}
}



Measured memory_bytes: 36860
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
using namespace std;
using ll = long long;
int main()
{
	ll a, b = 0, c = 0, d = 0;
	char C;
	char s[1000];
	cin >> a;
	for (int i = 1; i <= a; i++)
	{
		if (i%2==0)
		{
			c++;
		}
		else
		{
			b++;
		}
	}
	cout << b*c<<endl;

	return 0;
}

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



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


        string s;
        cin >> s;

        long long sum = 0;
        int length = s.size()-1;
        for(length;length>=0;length--)
        {
            sum += int(s[length] - '0');
        }

        if (sum % 9 == 0) cout << "Yes";
        else cout << "No";

    
    return 0;
}

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

int main() {
    int N, K; cin >> N >> K;
    vector<long long> p(N);
    for (int i = 0; i < N; ++i) cin >> p[i], ++p[i]; // 1 足しておく

    // 累積和
    vector<long long> s(N+1, 0);
    for (int i = 0; i < N; ++i) s[i+1] = s[i] + p[i];

    // K 差を見ていく
    long long res = 0;
    for (int i = 0; i+K <= N; ++i) res = max(res, s[i+K] - s[i]);
    cout << fixed << setprecision(10) << (double)(res)/2 << endl;
}


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

int main() {
	long x, ans = 0;
	size_t N;
	cin >> N >> x;
	vector<long> a(N);
	for (auto& x : a) cin >> x;
	for (size_t i = 1; i < N; ++i) {
		if (a.at(i - 1) + a.at(i) > x) {
			if (a.at(i - 1) > x) {
				ans += a.at(i - 1) - x;
				a.at(i - 1) = x;
				ans += a.at(i);
				a.at(i) = 0;
			}
			else {
				ans += a.at(i - 1) + a.at(i) - x;
				a.at(i) = x - a.at(i - 1);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int weight[1005];
int X[1005];
int N;
int P[1005];
vector<int> G[1005];
bool dp[1005][5005];
void dfs(int nod)
{
    long long ceva=0;
    for(auto it:G[nod])
    {
            dfs(it);
            weight[nod]+=weight[it];
            ceva+=min(X[it],weight[it]-X[it]);
    }
    if(X[nod]<ceva)
    {
        cout<<"IMPOSSIBLE";
        exit(0);
    }
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=0;i<G[nod].size();i++)
    {
        int it=G[nod][i];
        for(int j=0;j<=X[nod];j++)
        {
            if(dp[i][j])
            {
                if(j+X[it]<=X[nod])dp[i+1][j+X[it]]=1;
                if(j+weight[it]-X[it]<=X[nod])dp[i+1][j+weight[it]-X[it]]=1;
            }
        }
    }
    int tmp=X[nod];
    while(tmp>0&&!dp[G[nod].size()][tmp])tmp--;
    weight[nod]+=X[nod]-tmp;
}
int main()
{
    cin>>N;
    for(int i=2;i<=N;i++)
    {
        cin>>P[i];
        G[P[i]].push_back(i);
    }
    for(int i=1;i<=N;i++)cin>>X[i];
    dfs(1);
    cout<<"POSSIBLE";
    return 0;
}


Measured memory_bytes: 5248
#include<stdio.h>

int main()
{
    char S1[10],S2[]="ABC";
    int T;
    scanf("%s",S1);
    T=strcmp(S1,S2);
    if(T == 0)
    {
      printf("ARC\n");
    }
    else
    {
      printf("ABC\n");
    }
    return 0;
}

Measured memory_bytes: 1620
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+100;
int arr[maxn];
int pre[maxn];
int suf[maxn];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i)
        cin>>arr[i];
    for(int i=0;i<n;++i)
    {
        if(i+arr[i]<n)
        ++pre[i+arr[i]];
        if(i-arr[i]>=0)
        ++suf[i-arr[i]];
    }
    long long int ans=0;
    for(int i=0;i<n;++i)
    {
        ans+=(long long)pre[i]*suf[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5992
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


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

	int a, b, c;
	cin >> a >> b >> c;

	if (b >= c-a && a<=c)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
	cout << endl;

}

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

int main(){
  int n;
  cin >> n;
  vector<int>vec;
  float a, sum=0, avg=0, ans, res=0;
  for(int i=0; i<n; i++){
    cin >> a;
    vec.push_back(a);
    sum+=a;
  }
  avg=round(sum/n);
  for(int i=0; i<vec.size(); i++){
    ans=abs(avg-vec[i]);
    res+=ans*ans;
  }
  cout << res;
}


Measured memory_bytes: 3828
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int main() {
	string s;
	cin >> s;
	int ans=0;
	for(int i=0;i<s.size()/2;i++) {
		if(s[i]!=s[s.size()-i-1]) ans++;
	}
	cout << ans << endl;
} 

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#define ll long long
using namespace std;

int main(){
 //cout<<123<<endl;
 int a[20];
  int x;
  for(int i=0;i<4;i++){
    cin>>x;
    a[x]=1;
  }
  if(a[1]*a[7]*a[9]*a[4]>0) cout<<"YES"<<endl;
  else cout<<"NO";
  
  
        
  
  return 0;
}




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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

class UnionFind {
  private:
    ll num;
    vector<ll> par;
    vector<ll> sizes;
    vector<ll> rank;

  public:
    UnionFind(ll n) { init(n); }

    ~UnionFind() {}

    ll init(ll n) {
        num = n;
        par.resize(n);
        sizes.resize(n);
        rank.resize(n);
        for (ll i = 0; i < n; i++) {
            par[i] = i;
            sizes[i] = 1;
            rank[i] = 0;
        }
    }

    ll root(ll x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    void unite(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry)
            return;
        if (rank[rx] < rank[ry]) {
            par[rx] = ry;
        } else {
            par[ry] = rx;
            if (rank[rx] == rank[ry]) {
                rank[rx]++;
            }
        }
        ll temp = sizes[rx] + sizes[ry];
        sizes[rx] = temp;
        sizes[ry] = temp;
    }

    ll get_size(ll x) { return sizes[root(x)]; }

    bool same(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main() {
source:
    ll n, m;
    cin >> n >> m;
    ll a[m], b[m];
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    ll ans = 0;
    rep(i, m) {
        UnionFind u(n);
        rep(j, m) {
            if (j != i) {
                u.unite(a[j], b[j]);
            }
        }
        bool judge = true;
        rep(j, n) {
            if (!u.same(0, j)) {
                judge = false;
            }
        }
        if (!judge) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string A,B,C;
  cin >> A >> B >> C;
  int acnt = 0;
  int bcnt = 0;
  int ccnt = 0;
  A += 'k';
  B += 'k';
  C += 'k';
  char ch = A.at(0);
  int flag = 0;
  for(;;){
    if(ch == 'k')break;
    if(ch == 'a'){
      flag = 1;
      acnt++;
      ch = A.at(acnt-1);
    }
    if(ch == 'b'){
      flag = 2;
      bcnt++;
      ch = B.at(bcnt-1);
    }
    
    if(ch == 'c'){
      flag = 3;
      ccnt++;
      ch = C.at(ccnt-1);
    }
  }
  if(flag  == 1) cout<<"A"<<endl;
  else if(flag == 2) cout<<"B"<<endl;
  else cout<<"C"<<endl;
}


Measured memory_bytes: 3616
n=list(map(int, input().split()))
a = ""
for i in range(n[2]-n[0]):
        a += "R"
for i in range(n[3]-n[1]):
        a += "U"
for i in range(n[2]-n[0]):
        a += "L"
for i in range(n[3]-n[1]):
        a += "D"
a += "D"
for i in range(n[2]-n[0]+1):
        a += "R"
for i in range(n[3]-n[1]+1):
        a += "U"
a += "LU"
for i in range(n[2]-n[0]+1):
        a += "L"
for i in range(n[3]-n[1]+1):
        a += "D"
a += "R"
print(a)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

void solve(long long N, long long K){
    long double ans = 0;
    for(int i=1;i<=N;i++){
        long double add = 1/(long double)N;
        ll temp = i;
        while(temp<K){
            temp*=2;
            add /= 2.0;
        }
        ans += add;
    }
    cout <<setprecision(20)<< ans << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, K;
	cin >> N >> K;
	VLL H(N);
	in(H);
	sort(H.begin(), H.end(), [](LL a, LL b) {
		return a > b;
	});
	LL ans = 1e15;
	for (LL n = 0; n + K - 1 < N; n++) {
		ans = min(ans, H[n] - H[n + K - 1]);
	}
	cout << ans << "\n";
	return 0;
}

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

#define DEBUG(x) cerr << #x << " = " << x << endl

int main() {
    string str; cin >> str;
    string zip;
    for(int i = 0; i < (int)str.length(); ) {
        if(str[i] == 'e') {
            zip.push_back('e');
            i += 3;
        }
        else {
            zip.push_back('c');
            i += 7;
        }
    }
    vector<string> split;
    split.push_back(zip.substr(0, 1));
    for(int i = 1; i < (int)zip.length(); i++) {
        if(zip[i - 1] == zip[i]) {
            split.push_back(zip.substr(i, 1));
        }
        else {
            split.rbegin()->push_back(zip[i]);
        }
    }
#if 0
    for(int i = 0; i < (int)split.size(); i++) {
        DEBUG(split[i]);
    }
#endif
    string longest;
    for(int i = 0; i < (int)split.size(); i++) {
        if(split[i].size() > longest.size()) longest = split[i];
    }
    cout << (*longest.rbegin() == 'e' ? "egg" : "chicken") << endl;
}

Measured memory_bytes: 1224
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		System.out.println(solve(n));
		in.close();
	}

	private static String solve(int n) {
		int s = 0;
		int w = n;
		while (w > 0) {
			s += (w % 10);
			w /= 10;
		}
		if (n % s == 0)
			return "Yes";
		else
			return "No";
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(x) (((long long)x)%modulo)

int cnt_dp[8][2];//cnt_dp[i][j] i個の空間においてj=0->右端に線を引かない j=1->右端に線を引く
int cnt[8];
void init(){
	cnt_dp[0][0]=1;
	cnt_dp[0][1]=0;
	cnt[0]=1;
	for(int i=1;i<8;i++){
		cnt_dp[i][0]=cnt_dp[i-1][0]+cnt_dp[i-1][1];
		cnt_dp[i][1]=cnt_dp[i-1][0];
		cnt[i]=cnt_dp[i][0]+cnt_dp[i][1];
	}
	
}

int get_cnt(int i){
	if(i<0)return 1;
	return cnt[i];
}

int main(){
	init();
	int H,W,K;
	cin>>H>>W>>K;
	K--;
	vector<vector<int>> dp(H+1,vector<int>(W,0));//dp[i][j] 高さがiでjに至る物の本数
	dp[0][0]=1;
	
	for(int i=1;i<H+1;i++){
		for(int j=0;j<W;j++){
			dp[i][j]=mod(dp[i-1][j]*get_cnt(j-1)*get_cnt(W-j-2));
			if(j!=0){
				dp[i][j]=mod(dp[i][j]+mod(dp[i-1][j-1]*get_cnt(j-2)*get_cnt(W-j-2)));
			}
			if(j!=W-1){
				dp[i][j]=mod(dp[i][j]+mod(dp[i-1][j+1]*get_cnt(j-1)*get_cnt(W-j-3)));
			}
			
		}
	}
	
	cout<<dp[H][K]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
flag = False
bingo = [[False]*3 for _ in range(3)]

for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == A[i][j]:
                bingo[i][j] = True

for i in range(3):
    if bingo[i] == [True, True, True]:
        print("Yes")
        flag = True
        break
    elif bingo[0][i] and bingo[1][i] and bingo[2][i]:
        print("Yes")
        flag = True
        break
    elif (bingo[0][0] and bingo[1][1] and bingo[2][2]) or (bingo[0][2] and bingo[1][1] and bingo[2][0]):
        print("Yes")
        flag = True
        break

if not flag:
    print("No")
        

Measured memory_bytes: 3188
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var size = 'z'.charCodeAt(0)-'a'.charCodeAt(0);
  var cnt = [];
  for( var i=0; i<=size; i++ ) { cnt.push( 0 ); }
  
  for( var i=0; i<input.length; i++ ) {
    var az = input.toLowerCase().charCodeAt( i )-'a'.charCodeAt(0);
    if( 0 <= az && az <= size ) {
      cnt[ az ]++;
    }
  }
  for( var i=0; i<=size; i++ ) {
    console.log( String.fromCharCode( 'a'.charCodeAt(0)+i ) + " : "+cnt[i] );
  }
});

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

int main(void){
    string N;cin>>N;
    int ans=0;
    int check=0;
    if(N.size()==1){
        cout<<N[0]-'0'<<endl;
        return 0;
    }
    else{
        for(int i=1;i<N.size();i++){
            if(N[i]!='9'){
                break;
            }
            check++;
        }
        if(check==N.size()-1){
            ans+=N[0]-'0';
            ans+=9*(N.size()-1);
            cout<<ans<<endl;
            return 0;
        }
        else{
            ans+=9*(N.size()-1);
            ans+=N[0]-'1';
            cout<<ans<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
    #define REP(i,n) for(int i=0;i<n;i++)
    #define LOOP(i,x,n) for(int i=x;i<n;i++)
    #define ALL(v) (v).begin(),(v).end()
    #define PB push_back
    #define MP make_pair
    #define FIR first
    #define UB upper_bound
    #define LB lower_bound
    #define int long long
    using namespace std;
    const int MOD=1000000007;
    const int INF=1000000009;
     
    signed main(){
      int n,k;
      cin>>n>>k;
      vector<int> a(n+1),b(n+1);
     
      int tmp=1;
      REP(i,n){
        int a=tmp*2;
        int b=tmp+k;
        tmp=min(a,b);
      }
      cout<<tmp<<endl;
      return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int k,n,l;
long long res,MOD=1000000007,p25[2000100];
long long inv[2000100],fac[2000100],ifac[2000100];
void init_math(int N){
	inv[1]=1LL;
	for(int i=2;i<=N;i++)
		inv[i]=(MOD-((MOD/i)*inv[MOD%i])%MOD);
	fac[0]=1LL;
	ifac[0]=1LL;
	for(int i=1;i<=N;i++){
		fac[i]=(fac[i-1]*(long long)(i))%MOD;
		ifac[i]=(ifac[i-1]*inv[i])%MOD;
	}
}
long long C(int x,int y){
	return ((fac[x]*ifac[y])%MOD*ifac[x-y])%MOD;
}
string s;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>k>>s;
	n=s.size()+k;
	l=s.size();
	init_math(n);
	p25[0]=1;
	for(int x=1;x<=n;x++){
		p25[x]=(p25[x-1]*25LL)%MOD;
	}
	for(int x=l;x<=n;x++){
		res=(res+C(n,x)*p25[n-x]%MOD)%MOD;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 66788