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

namespace mondai0036
{
	class Program
	{
		static void Main(string[] args)
		{
			string[,]	figure	= new string[ 7, 4 ] {
				{ "00000011", "00000011", "00000000", "00000000" },		// A
				{ "00000001", "00000001", "00000001", "00000001" },		// B
				{ "00001111", "00000000", "00000000", "00000000" },		// C
				{ "00000001", "00000011", "00000010", "00000000" },		// D
				{ "00000110", "00000011", "00000000", "00000000" },		// E
				{ "00000010", "00000011", "00000001", "00000000" },		// F
				{ "00000011", "00000110", "00000000", "00000000" },		// G
			};
			
			while( true ) {
				var	surface	= new int[ 8 ];
				for( int i = 0; i < 8; i++ ) {
					surface[ i ]	= Convert.ToInt32( Console.ReadLine(), 2 );
				}

				// 平面図の「1」が上端にくるようにする
				for( int i = 0; i < 8; i++ ) {
					if( surface[ 0 ] == 0x00 ) {
						for( int j = 1; j < 8; j++ ) {
							surface[ j - 1 ]	= surface[ j ];
						}
						surface[ 7 ]	= 0x00;
					} else {
						break;
					}
				}
				
				// 平面図の「1」が右端にくるようにする
				for( int i = 0; i < 8; i++ ) {
					int	j;
					for( j = 0; j < 8; j++ ) {
						if( (surface[ j ] & 0x01) == 0x01 ) {
							break;
						}
					}
					if( j >= 8 ) {
						for( int k = 0; k < 8; k++ ) {
							surface[ k ] >>= 1;
						}
					} else {
						break;
					}
				}

				// 図形判定
				for( int i = 0; i < 7; i++ ) {
					int	j;					
					for( j = 0; j < 4; j++ ) {
						if( surface[ j ] != Convert.ToInt32( figure[ i, j ], 2 ) ) {
							break;
						}						
					}
					if( j >= 4 ) {
						Console.WriteLine( "{0}", (char)('A' + i) );
					}
				}
				
				if( Console.ReadLine() == null ) {
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 5412
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define ll long long
#define mod 1000000007LL
#define INF 123456789012345
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =2e5 + 10;
int a[maxn];
int check[maxn];

int main() {
	int n;cin >> n;
	rep(i,n) cin >>a[i];

	rep(i,n)
	{
		if(a[i] > i)
		{
			cout << -1 << endl;
			return 0;
		}

		if(i == 0) continue;

		if(a[i] > a[i-1]+1)
		{
			cout << -1 << endl;
			return 0;
		}
	}
	ll ans = 0;
	for(int i=n-1;i>=0;i--)
	{
		if(i == n-1) 
		{
			ans += a[i];
			continue;
		}

		if(a[i]+1 == a[i+1]) continue;

		ans += a[i];

	}

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

Measured memory_bytes: 1024
MODE = "stdio"

line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  3 4
  5 6
  3 3
  0 0
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end
r=Array.new
r = line.map{|s|s.split(" ")}

r.each{|s| s.map!(&:to_i)}.each do |h,w|
  break if h==0 && w==0
  puts "#"*w
  (h-2).times do
    puts "#" + "."*(w-2) +"#"
  end
  puts "#"*w
  puts "\n"
end

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

main() {
    string S; cin >> S;
    rep(i,S.size()){
        if(isupper(S[i])) S[i]=tolower(S[i]);
    }
    int ans=0;
    for(;;){
        string T; cin >> T;
        if(T=="END_OF_TEXT") break;
        rep(i,T.size()){
            if(isupper(T[i])) T[i]=tolower(T[i]);
        }
        if(T==S) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3160
# -*- coding: utf-8 -*-
# E: bit演算を活用して効率的に計算しないとTLEになる

# dp[[i][j]で、(i,j)で可能な偏りを格納していく
# 1, 2, 3が可能な場合は"00000111"と表現する
# n + m を可能にするには、n << mにすれば良い
# (1, 2, 3)に2を足して(3, 4, 5)を可能にするなら、
# "00011100"としたいので、n << mで良い
# (3, 4, 5)に±4する場合；
# 求めたいのは(7, 8, 9) | (-1, 0, 1)
# −１を1としたい

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
a = []
x = []

for i in range(H):
    a.append(list(map(int, input().split())))
for i in range(H):
    x.append(list(map(int, input().split())))
    for j in range(W):
        x[i][j] = abs(x[i][j] - a[i][j])


dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1 << x[0][0]
# print(bin(dp[0][0]))


def reverse(d, x):
    res = 0
    for i in range(x+1):
        res <<= 1
        if (1<<i) & d:
            res |= 1
    return res


for i in range(H):
    for j in range(W):
        g = x[i][j]
        if i > 0:
            d1 = dp[i-1][j]
            dp[i][j] |= d1 << g | d1 >> g | reverse(d1, g)
        if j > 0:
            d2 = dp[i][j-1]
            dp[i][j] |= d2 << g | d2 >> g | reverse(d2, g)


a = dp[H-1][W-1]
for i in range(a.bit_length()):
    if a >> i & 1 == 1:
        print(i)
        sys.exit()


Measured memory_bytes: 54744
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
    int n,m;
    cin >> n >> m;
    VI a(n);
    int cnt = 0;
    double sum = 0;
    rep(i,n) {
        cin >> a[i];
        sum += a[i];
    }

    rep(i,n) {
        if(a[i] >= sum/(4*m)) {
            // cout << (1/(4*m))*sum << endl;
            cnt++;
        }
    }

    if(cnt >= m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i<n;i++)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define all(v) v.begin(),v.end()

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
	// cin>>t;
	while(t--){
		int n;
		cin>>n;
		int arr[n];
		forn(i,n) cin>>arr[i];
		int ans = 1;
		int minim = arr[0];
		forn(i,n-1){
			if(arr[i+1]<=minim){
				ans++;
			}
			minim = min(minim,arr[i+1]);
		}
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <utility>
#include <functional>
#include <stack>
#include <deque>
#include <sstream>
using namespace std;

#define ll long long
#define mod 1000000007
#define ld long double
#define infinity (ll)1e18+1
#define PI 3.14159265358979

#define pdd pair<double,double>
#define pll pair<ll, ll>
#define pii pair<int,int>

#define MP make_pair
#define SZ size()
#define PB push_back

#define vi vector<int>//ll
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define vch vector<char>
#define vb vector<bool>
#define vld vector<ld>
#define vs vector<string>

#define FOR(i,a,b) for(ll i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(ll i = (b) - 1; i >= (a); --i)
#define REPEAT(i) FOR(counter1234,0,i)
#define ALL(a) a.begin(), a.end()
#define X first
#define Y second
#define MAXN 10001
/*
ll power(ll n, ll to)
{
	if (to == 0) return 1;
	if (to == 1) return n;
	int exp = 1;
	ll ans = n;
	while (2 * exp <= to)
	{
		ans *= ans;
		ans %= mod;
		exp *= 2;
	}
	return ((ans*power(n, to - exp)) % mod);
}

ll gcd(ll a, ll b)
{
	if (a < b)
		swap(a, b);

	if (b == 0)
		return a;

	if (a < b)
		swap(a, b);

	return gcd(b, a%b);
}

pll add(int a, int b)
{
	if (a > b)
		swap(a, b);

	ll mult = 1;
	FOR(i, a, b + 1)
	{
		mult *= i;
		mult %= mod;
	}

	ll num = 0;
	FOR(i, a, b + 1)
	{
		num += (mult * power(i, mod - 2));
		num %= mod;
	}

	return MP(num, mult);
}

ll n;
vll a, b;

int main()
{
	srand(time(NULL));
	clock_t startTime = clock();
	ios_base::sync_with_stdio(false), cin.tie(0);
	//ifstream in("In.txt");

	cin >> n;
	a.assign(n, 0);
	b.assign(n - 1, 0);
	FOR(i, 0, n)
		cin >> a[i];

	FOR(i, 0, n - 1)
		cin >> b[i];

	sort(ALL(a));

	if (n == 2)
	{
		ll p, q;

		p = b[0];
		q = a[1] - a[0];

		auto sum = add(a[0] + 1, a[1]);
		
		p *= sum.first;
		q *= sum.second;
		p %= mod;
		q %= mod;

		ll res = p % mod;
		res *= power(q, mod - 2);
		cout << res%mod;
	}
	else
	{
		if (n == 3)
		{
			pll c1, c2, c3;
			c2.X = a[1] * b[1] - b[0];
			c2.Y = (a[2] - a[1])*(a[1] - a[0]);

			c1.X = a[0] * b[1] - b[0];
			c1.Y = (a[2] - a[0])*(a[0] - a[1]);

			c1.X %= mod;
			c1.Y %= mod;
			c2.Y %= mod;
			c2.X %= mod;

			c3.Y = c1.Y * c2.Y;
			c3.X = mod * mod - (c1.Y * c2.X + c1.X * c2.Y);

			c3.X %= mod;
			c3.Y %= mod;




		}
	}
	

	
	return 0;
}*/

int main()
{
	srand(time(NULL));
	clock_t startTime = clock();
	ios_base::sync_with_stdio(false), cin.tie(0);
	//ifstream in("In.txt");

	int n; cin >> n;
	vll a(n);
	FOR(i, 0, n)
		cin >> a[i];

	
	sort(ALL(a));
	map<int, int> m;
	FOR(i, 0, n)
		m[a[i] / 400]++;

	int ye = 0;
	FOR(i, 0, 8)
		if (m[i] > 0)
			ye++;

	int top = 0;
	FOR(i, 0, n)
		if (a[i] >= 3200)
			top++;

	if (ye == 0)
	{
		cout << 1 << " " << top;
	}
	else
			cout << ye << " " <<  ye + top;



	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	long res;
	int i;
	
	scanf("%d", &n);
	res = 1;
	for (i = 1; i <= n; i++){
		res *= i;
	}
	
	printf("%ld\n", res);
	
	return (0);
}

    




Measured memory_bytes: 1984
import java.util.*;
import java.math.*;
     
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){

            long x = sc.nextLong();

            if(x < 7) System.out.println(1);
            else if(x < 11) System.out.println(2);
            else if(x % 11 == 0) System.out.println((x/11)*2);
            else if(x % 11 < 7) System.out.println((((x - (x % 11))/11)*2) + 1);
            else System.out.println((((x - (x % 11))/11)*2) + 2);

        }catch(Exception e){
            e.printStackTrace();
        }        
    }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int X; cin >> X;
  int vmax = 1;
  for (int i = 2; i < X; ++i) {
    int j = i * i;
    while (j <= X) {
      vmax = max(vmax, j);
      j *= i;
    }
  }
  cout << vmax << endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;


int main(){
  int w,h,n; cin >> w >> h >> n;
  vector<vector<int>> g(h,vector<int>(w,0));

  vector<int> x(n),y(n),a(n);
  rep(i,n) cin >> x[i] >> y[i] >> a[i];
  rep(i,n){
    if(a[i] == 1){
      rep(k,h)rep(j,x[i]){
        g[k][j] = 1;
      }
    }else if(a[i] == 2){
      rep(k,h)for(int j = x[i]; j < w; j++){
        g[k][j] = 1;
      }
    }else if(a[i] == 3){
      rep(k,y[i])rep(j,w){
        g[k][j] = 1;
      }
    }else{
      for(int k = y[i]; k < h; k++)rep(j,w){
        g[k][j] = 1;
      }
    }
  }
  int ans = 0;
  rep(i,h)rep(j,w){
    if(g[i][j] == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

const int mod = 1'000'000'007;

int dp[101][4][4][4];
int main(){
  int n; cin >> n;

  dp[0][3][3][3] = 1;

  for(int len=0; len<n; ++len){
    for(int i=0; i<4; ++i){
      for(int j=0; j<4; ++j){
        for(int k=0; k<4; ++k){
          if(dp[len][i][j][k] == 0) continue;

          for(int a=0; a<4; ++a){
            if(a == 1 && j == 0 && i == 2) continue;
            if(a == 2 && j == 0 && i == 1) continue;
            if(a == 1 && j == 2 && i == 0) continue;
            if(a == 1 && k == 0 && i == 2) continue;
            if(a == 1 && k == 0 && j == 2) continue;

            dp[len+1][a][i][j] += dp[len][i][j][k];
            dp[len+1][a][i][j] %= mod;
          }
        }
      }
    }
  }

  long long ans = 0;
  for(int i=0; i<4; ++i){
    for(int j=0; j<4; ++j){
      for(int k=0; k<4; ++k){
        ans += dp[n][i][j][k];
        ans %= mod;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            char[][] map = in.nextCharacterMap(2, 3);
            for (int i = 0; i < 3; ++i) {
                if (map[0][i] != map[1][2 - i]) {
                    out.println("NO");
                    return;
                }
            }
            out.println("YES");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public char nextCharacter() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            return (char) c;
        }

        public char[] nextCharacterArray(int n) {
            char[] chars = new char[n];
            for (int i = 0; i < n; i++) {
                chars[i] = nextCharacter();
            }
            return chars;
        }

        public char[][] nextCharacterMap(int n, int m) {
            char[][] map = new char[n][];
            for (int i = 0; i < n; i++) {
                map[i] = nextCharacterArray(m);
            }
            return map;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

int main() {
    int h, w;
    cin >> h >> w;
    char c[h][w];
    rep(i, h) rep(j, w) cin >> c[i][j];

    rep(i, h) rep(_, 2) {
        rep(j, w) cout << c[i][j];
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main() {
        int n;
        string s;
        cin >> n >> s;
        int x = 0;
        int ma = 0;
        for (int i=0; i<n; ++i) {
                if (s[i]=='D') {
                        x = x-1;
                } else {
                        x = x+1;
                        ma = max(ma, x);
                }
        }
        cout << ma << endl;
        return 0;
}


Measured memory_bytes: 256
import kotlin.math.*
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*


private var fs = BufferedReader(InputStreamReader(System.`in`))
private fun readLn() = fs.readLine()!! // string line
private fun readStrings() = readLn().split(" ") // list of strings
private fun readLong() = readLn().toLong()
private fun readLongs() = readStrings().map { it.toLong() } // list of ints
private fun readInt() = readLn().toInt() // single int
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    solveAtc()
}
fun solveAtc() {
    var n = readInt()
    var str = readLn()
    if(str.length <= n) println(str)
    else{
        var ans = ""
        for(i in 0 until n){
            ans += str[i]
        }
        ans += "..."
        println(ans)
    }
}


Measured memory_bytes: 33900
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define ll long long
#define int long long
#define pb push_back
using namespace std; 

const ll N = 1e6 + 100, OO = 1e10 + 10, M = 1e9 + 7, lg = 20;
typedef pair <int, int> pii;

int32_t main() {
	string s;
	cin >> s;
	if(s == "Sunny") {
		cout << "Cloudy" << endl;
		return 0;
	}
	else if(s == "Cloudy") {
		cout << "Rainy" << endl;
		return 0;
	}
	else {
		cout << "Sunny" << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define endl "\n"
#define inf 1<<30
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ss stringstream
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x , y , sizeof(x))
#define bit_cnt(mask) __builtin_popcount(mask)
using namespace std;
typedef long long ll;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const ll MOD = 1000000007; /// 1e9+7
const int MAX = 100005;     /// 1e5+5
ll bigmod(ll n, ll r)
{
    if(r==0) return 1;
    if(r==1) return n;
    if(r%2==0)
    {
        ll ret = bigmod(n, r/2);
        return ((ret%MOD) * (ret%MOD)) % MOD;
    }
    else return ((n%MOD) * (bigmod(n,r-1)%MOD)) % MOD;
}
ll modinverse(ll a){return bigmod(a,MOD-2)%MOD;}
ll lcm(ll a, ll b) {a=abs(a); b=abs(b); return (a/__gcd(a,b))*b;}
ll gcd(ll a, ll b) {a=abs(a); b=abs(b); if(!b) return a; return __gcd(b,a%b);}
//int in() {int x; scanf("%d",&x); return x;}
//ll lin() {ll x; scanf("%lld",&x); return x;}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s; cin>>s;
    int a = 0;
    a += (s[0]=='1');
    a += (s[1]=='1');
    a += (s[2]=='1');
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  string ss,tt;
  map<char,char> ms,mt;
  char cs='a',ct='a';
  for(int i=0;i<s.size();i++){
    if(!ms.count(s.at(i))){
      ms[s.at(i)]=cs;
      cs++;
    }
    if(!mt.count(t.at(i))){
      mt[t.at(i)]=ct;
      ct++;
    }
    ss+=ms.at(s.at(i));
    tt+=mt.at(t.at(i));
  }
  cout<<(ss==tt?"Yes":"No")<<endl;
}

Measured memory_bytes: 4336
// Problem: B - Making Triangle
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_b
// Parsed on: 2020-09-02 13:00:08
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);

using namespace std;

int main() {
    int s;
    cin >> s;
    vector<int> arr(s);
    int ans = 0;
    for (auto &e : arr) cin >> e;
    for (int i = 0; i < s; i++)
        for (int j = i + 1; j < s; j++)
            for (int k = j + 1; k < s; k++) {
                if (arr[i] != arr[j] && arr[j] != arr[k] && arr[k] != arr[i]) {
                    vector<int> col = {arr[i], arr[j], arr[k]};
                    sort(col.begin(), col.end());
                    if (col[0] + col[1] > col[2]) ans++;
                }
            }

    cout << ans;
    return 0;
}


Measured memory_bytes: 3168
#include <stdio.h>
#include <algorithm>
using namespace std;

int N,A[202];

int main()
{
	scanf ("%d",&N);
	for (int i=0;i<N*2;i++) scanf ("%d",&A[i]);
	sort(A,A+N*2);

	int ans = 0;
	for (int i=0;i<N*2;i+=2) ans += A[i];
	printf ("%d\n",ans);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int n;
    cin >> n;
    vi a(n + 1);
    for (int i = 1; i < n + 1; i++)
    {
        scanf("%d", &a[i]);
    }

    int cnt = 0;
    vi ans(n + 1, 0);
    for (int i = n; i >= 1; i--)
    {
        int j = i;
        ans[i] = a[i];
        j += i;
        while (j <= n)
        {
            ans[i] ^= ans[j];
            j += i;
        }
        if (ans[i] == 1)
        {
            cnt++;
        }
    }

    cout << cnt << endl;
    for (int i = 1; i < n + 1; i++)
    {
        if (ans[i] == 1)
        {
            printf("%d ", i);
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 
 
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数
 
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
 
        // その結果を push
        res.push_back({a, ex});
    }
 
    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}
 
int main(int argc, const char * argv[]) {
    char s; cin >> s;
    
    if(isupper(s)){
        cout << 'A' << endl;
    }
    else{
        cout << 'a' << endl;
    }
    return 0;
}

Measured memory_bytes: 6244
#include<bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define fo(i,a,n) for(int i=a;i<n;i++)
#define ll long long int
#define li long int
using namespace std;
int n;
vector<int> a(100005);
vector<int> dp(100005,-1);
int fun(int ind)
{
    if(ind==n-1)
        return 0;
    if(ind>=n)
        return INT_MAX;
    if(dp[ind]==-1)
    {
        int left=fun(ind+1)+(abs(a[ind]-a[ind+1]));
        int right=INT_MAX;
        if(ind+2<n)
            right=fun(ind+2)+(abs(a[ind]-a[ind+2]));
        dp[ind]=min(left,right);
    }
    return dp[ind];

}
int main()
{
    cin>>n;
    f(i,n)
        cin>>a[i];
    cout<<fun(0);
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n,k;
    cin>>n>>k;


    cout<<min(n%k,((-n)%k+k)%k);


    return 0;
}


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

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

int main(){
	string s, t;
	cin >> s >> t;
	int ans=0;
	rep(i,s.size()) if(s[i]!=t[i]) ans++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getchar(char ch){
  if(ch=='A') return 1;
  else if(ch=='C') return 2;
  else if(ch=='G') return 3;
  else if(ch=='T') return 4;
  else return 0;
}

long long getkey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getchar(str[i]));
    p*=5;
  }
  return sum;
}

int h1(int key){return key%M;}

int h2(int key){return 1+(key%(M-1));}

int find(char str[]){
  long long key,i,h;
  key=getkey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(str,H[h])==0) return 1;
    else if(strlen(H[h])==0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getkey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++) H[i][0]='\0';
  cin>>n;
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)) cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 17536
n, a, b = map(int, input().split())

def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums

answer = 0
for num in range(1, n+1):
    sums = calc_digit_sum(num)
    if a <= sums <= b:
        answer += num

print(answer)

Measured memory_bytes: 72972
#include <stdio.h>
int main(void)
{
    int d,m,i,j;
long long int x=1;
scanf("%d %d",&d,&m);
if(d-m==1 || d-m==-1 || d-m==0)
{
   for(i=1;i<d+1;i++)
   {
      x *= i;
      x %=1000000007;
   }
   for(j=1;j<m+1;j++)
   {
      x *= j;
      x%=1000000007;
   }
}
else
{
   x=0;
}
 
if(d-m==0)
{
   x=x*2;
   while(x>1000000007)
     x-=1000000007;
}
printf("%lld",x);
 
}

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

int main()
{
	int i, n;
    double x1, x2, x3, y1, y2, y3;
    double a, b, c, d, e, f;
    double X1, Y1, r;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1, &y1, &x2, &y2, &x3, &y3);
        a = 2 * (x2 - x1);
        b = 2 * (y2 - y1);
        c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        d = 2 * (x3 - x1);
        e = 2 * (y3 - y1);
        f = x1*x1 - x3*x3 + y1*y1 - y3*y3;
        
        X1 = (b*f - e*c) / (a*e - d*b);
        Y1 = (c*d - f*a) / (a*e - d*b);
        r  = sqrt((X1-x1)*(X1-x1) + (Y1-y1)*(Y1-y1));
        
        X1 *= 1000;
        Y1 *= 1000;
        r  *= 1000;
        
        X1 = (int)(X1 > 0.0 ? X1+0.5 : X1-0.5);
        Y1 = (int)(Y1 > 0.0 ? Y1+0.5 : Y1-0.5);
        r  = (int)(r  > 0.0 ? r +0.5 : r -0.5);
        
        X1 = (double)X1/1000;
        Y1 = (double)Y1/1000;
        r  = (double)r /1000;
        
        printf("%.3f %.3f %.3f\n", X1, Y1, r);
        }
    
    return 0;
}

Measured memory_bytes: 664
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        s = s.substring(0, k - 1) + s.substring(k - 1, k).toLowerCase() + s.substring(k);
        System.out.println(s);
    }
}


Measured memory_bytes: 39084
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

	//------------------------------------------

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}

	//------------------------------------------


	public void exec() throws Exception{
		final String S = sc.next();
		int N = S.length()/2;
		int cnt=0;
		for(int i=0;i<N;i++) {
			if(S.charAt(i)!=S.charAt(S.length()-1-i)) {
				cnt++;
			}
		}
		out.println(cnt);
	}
}


Measured memory_bytes: 23252
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        s: chars,
        q: usize,
        v: [usize; q]
    }
    for k in v {
        let mut dc = 0;
        let mut mc = 0;
        let mut comb: usize = 0;
        let mut ans: usize = 0;
        if s[0] == 'D' {
            dc = 1;
        } else if s[0] == 'M' {
            mc = 1;
        }
        for i in 1..n {
            if i >= k {
                if s[i - k] == 'D' {
                    comb -= mc;
                    dc -= 1;
                } else if s[i - k] == 'M' {
                    mc -= 1;
                }
            }
            if s[i] == 'D' {
                dc += 1;
            } else if s[i] == 'M' {
                comb += dc;
                mc += 1;
            } else if s[i] == 'C' {
                ans += comb;
            }
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 13560
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 200010
using namespace std;
typedef long long ll;
int n;
ll ans,a[MAXN],L,lft,rit,nstl,nstr,num;
int main(){
	SF("%lld%d",&L,&n);
	for(int i=1;i<=n;i++)
		SF("%lld",&a[i]);
	ans=a[n];
	nstl=n;
	nstr=n+1;
	for(int i=n;i>=1;i--){//block between i and i-1
		if(i!=n)
			ans=max(ans,a[i]+2*(L-a[i+1]));
		else
			ans=max(ans,L-a[i]+2*a[i-1]);
		num=min(n-i,i-1);
		rit-=a[i];
		while(i-nstr<num&&nstr>1){
			nstr--;
			rit+=(a[nstr]);	
		}
		while(nstl-i>num&&nstl>0){
			lft-=(L-a[nstl]);
			nstl--;
		}
//		PF("[%d %lld %lld %lld]\n",i,lft,rit,(lft+rit)*2+max(L-a[i],a[i]));
		int lastl,lastr;
		if(nstl==n)
			lastl=0;
		else
			lastl=(L-a[nstl+1])*2;
		if(nstr==0)
			lastr=0;
		else
			lastr=a[nstr-1]*2;
		ans=max(ans,(lft+rit)*2+max(a[i]+lastl,L-a[i]+lastr));
		lft+=(L-a[i]);
	}
	PF("%lld",ans);
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int n;
int a[11];

ll dfs(int i, ll prod) {
	if (i == n) return prod % 2 == 0 ? 1 : 0;
	ll res = 0;
	for (int j = -1; j <= 1; ++j) {
		res += dfs(i + 1, prod*(a[i] + j));
	}
	return res;
}

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

Measured memory_bytes: 256
n = int(input())
monsters = [int(x) for x in input().rstrip("\n").split(" ")]
damages = [int(x) for x in input().rstrip("\n").split(" ")]
total_monsters = sum(monsters)
result = 0
remain = monsters[n]
for i in range(n-1,-1,-1):
  
  damage = damages[i]
  monster = monsters[i]
  #print(i, remain,damage, monster, result)
  if damage <= remain:
    result += damage
    remain = monster
  else:
    damage -= remain
    result += remain
    if monster >= damage:
      remain = monster - damage
      result += damage
    else:
      result += monster
      remain = 0
print(result)
  


Measured memory_bytes: 19156
#include <vector>
#include <iostream>
using namespace std;
const int mod = 1000000007;
int n; vector<int> inv, mul; vector<vector<int> > g;
vector<int> solve(int pos, int pre) {
	vector<int> dp = { 0, 1 };
	for (int i : g[pos]) {
		if (i == pre) continue;
		vector<int> res = solve(i, pos);
		vector<int> ndp(dp.size() + res.size() - 1);
		for (int j = 0; j < dp.size(); ++j) {
			for (int k = 0; k < res.size(); ++k) {
				ndp[j + k] = (ndp[j + k] + 1LL * dp[j] * res[k]) % mod;
			}
		}
		dp = ndp;
	}
	for (int i = 2; i < dp.size(); i += 2) {
		dp[0] = (dp[0] + 1LL * dp[i] * mul[i]) % mod;
	}
	dp[0] = (mod - dp[0]) % mod;
	return dp;
}
int main() {
	cin >> n;
	g.resize(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b; --a, --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	inv.resize(n + 1); inv[1] = 1;
	for (int i = 2; i <= n; ++i) {
		inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;
	}
	mul.resize(n + 1); mul[0] = 1;
	for (int i = 2; i <= n; i += 2) {
		mul[i] = 1LL * mul[i - 2] * ((1LL * i * (i - 1)) / 2 % mod) % mod * inv[i / 2] % mod;
	}
	vector<int> res = solve(0, -1);
	cout << (mod - res[0]) % mod << '\n';
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i, h, m;
    cin >> i;
    h = i / 3600;
    i %= 3600;
    m = i / 60;
    i %= 60;
    cout << h << ":" << m << ":" << i << endl;
}


Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <map>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i > (b); --i)
#define SZ(a) a.size()
#define ll long long
#define ull unsigned long long
using namespace std;

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

	int N;
	ll x;
	vector<ll> a;
	cin >> N >> x;

	FOR(i, 0, N) {
		ll _a;
		cin >> _a;
		a.push_back(_a);
	}

	sort(a.begin(), a.end());
	
	int child = 0;
	ll stock = x;
	FOR(i, 0, N) {
		stock -= a[i];
		if (stock >= 0) {
			child++;
		}
		else
			break;
	}
	if (stock <= 0)
		cout << child << endl;
	else
		cout << child - 1 << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <random>
#include <map>
using namespace std;

const double pi = acos(-1);
#define nyan cout << "(=^•ω•^=)" << endl;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop while(true)
#define YN(f) f?cout<<"YES"<<endl:cout<<"NO"<<endl;
#define yn(f) f?cout<<"Yes"<<endl:cout<<"No"<<endl;

int n,p;
int ans;

signed main(){
	cin>>n>>p;
	if(n==1){
		cout<<p<<endl;
		return 0;
	}
	else if(n==2){
		for(int i=1;i<=sqrt(p);i++){
			if(p%(i*i)==0)ans=max(ans,i);
		}
		cout<<ans<<endl;
		return 0;
	}
	else if(n>=40){
		cout<<1<<endl;
		return 0;
	}
	int num=1;
	loop{
		if(pow(num,n)>p)break;
		if(p%((int)pow(num,n))==0)ans=max(ans,num);
		num++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

bool isEachDifferent(ll a,ll b,ll c){
	if( a == b || b == c || a == c) return false;
	return true;
}



int main(){
	ll X,K,D;
	cin>>X>>K>>D;
	X = abs(X);
	ll ans;
	ll ok = K;
	ll ng = 0;
	double dX = X;
	double dK = K;
	double dD = D;
	if( dX / dK >= dD){
		ans = X - K*D;
	}else{
		K = K - (X / D);
		if( K % 2 == 0){
			ans = X % D;
		}else{
			ans = abs(X%D - D);
		}
	}
	
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)

int main(){
    dcl(n);
    vector<ll> a(n);
    rep(i,n){
        get(a[i]);
        a[i]*=-1;
    }
    ll ans=0;
    rep(i,n){
        dcl(tmp);
        a[i]+=tmp;
        if(a[i]<0){
            ans-=a[i];
            a[i]=0;
        }
    }
    ll cnt=ans;
    // cout<<cnt<<endl;
    // puti(a);
    rep(i,n){
        cnt-=a[i]/2;
        if(cnt<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;

}

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

int main() {
  int n,a,ans=1000; cin >> n;
  for (int i = 0; i < n; i++) {
    /* code */
    cin >> a;
    int cnt = 0;
    while (a%2 == 0) {
      /* code */
      a = a/2;
      cnt += 1;
    }
    ans = min(ans,cnt);
  }
  std::cout << ans << '\n';
}


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

const int mod = 1000000007;
//const int mod = 998244353;
const int INF = 1001001001;

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main()
{
    string s;
    cin >> s;
    for(int i = s.size()-2; i >= 0; i -= 2){
        string p, q;
        p = s.substr(0, i/2);
        q = s.substr(i/2, i/2);
        //cout << i << " " << p << " " << q << endl;
        if(p == q){
            cout << p.size() + q.size() << endl;
            return 0;
        }
    }
    return 0;
}


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

typedef long long int int64;

const int mod=1000000007;

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int *inv=(int *)calloc(n+1,sizeof(int));
  int *invSum=(int *)calloc(n+1,sizeof(int));
  inv[1]=invSum[1]=1;
  for(i=2;i<=n;i++){
    inv[i]=(int64)(mod-mod/i)*inv[mod%i]%mod;
    invSum[i]=(inv[i]+invSum[i-1])%mod;
  }
  int sum=0;
  for(i=0;i<n;i++){
    sum=(sum+(int64)a[i]*(invSum[n-i]+invSum[i+1]-1))%mod;
  }
  for(i=1;i<=n;i++) sum=(int64)sum*i%mod;
  printf("%d\n",sum);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int n,a,h[1919];
double t;
int main(){
	cin>>n>>t>>a;
	double b=10000000;
	int c;
	for(int i=0;i<n;i++){
		cin>>h[i];
		if(b>abs(a-(t-h[i]*0.006))){
			b=abs(a-(t-h[i]*0.006));
			c=i+1;
		}
	}
	cout<<c<<endl;	
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
li = []
ans = "APPROVED"

for i in range(N):
  if A[i] % 2 == 0:
    li.append(A[i])

for i in li:
  if i % 5 == 0 or i % 3 == 0:
    ans = "APPROVED"
  else:
    ans = "DENIED"
    break
print(ans)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pair<int, int>> v;
	for (int i = 1; i <= n; i++) {
		int attend;
		cin >> attend;
		v.pb(mp(i, attend));
	}

	sort(ALL(v), [](const pair<int, int>& a, const pair<int, int>& b) {return a.second < b.second; });

	for (int i = 0; i < n; i++) {
		cout << v[i].first << " ";
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,ans,qzh[100005],hzh[100005],f[3005][3005];
char s[100005];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	f[1][1]=1,qzh[1]=1,hzh[1]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			if(s[i-1]=='>') f[i][j]=hzh[j];
			else f[i][j]=qzh[j-1];
			//printf("f(%d,%d)=%d\n",i,j,f[i][j]);
		}
		qzh[1]=f[i][1];
		for(int j=2;j<=i;j++) 
		{
			qzh[j]=qzh[j-1]+f[i][j];
			if(qzh[j]>=mod) qzh[j]-=mod;
		}
		hzh[i]=f[i][i];
		for(int j=i-1;j>=1;j--)
		{
			hzh[j]=hzh[j+1]+f[i][j];
			if(hzh[j]>=mod) hzh[j]-=mod;
		}
	}
	for(int i=1;i<=n;i++)
	{
		ans+=f[n][i];
		if(ans>=mod) ans-=mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 34304