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


public class Contest
{
	public static void Main()
	{
//		int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));

//		int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
//		int[] c = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
//		int[] d = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
/*
		int n = a[0];
		int[][] e = new int[n][];
		for(int i=0; i<n; i++) e[i] = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
*/

		string ss = Console.ReadLine();
		
		int aaa = 999;
		for(int i=0; i<ss.Length-2;i++) {
			int bbb = int.Parse(ss.Substring(i, 3));
			if(Math.Abs(753-bbb)< aaa)aaa=Math.Abs(753-bbb);
		
		
		}


		string ans = aaa.ToString();

		Console.WriteLine(ans);
	}
	
	private static int calc_main(int[] a,int[] b,int[] c,int[] d) {



		return 0;
	}




}


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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}

template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

template <typename T = int64>
vector<T> make_v(size_t a) {
  return vector<T>(a);
}

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
  t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename F>
struct FixPoint : F {
  FixPoint(F &&f) : F(forward<F>(f)) {}

  template <typename... Args>
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward<Args>(args)...);
  }
};

template <typename F>
inline decltype(auto) MFP(F &&f) {
  return FixPoint<F>{forward<F>(f)};
}

int main() {
  int64 N;
  int64 K;
  cin >> N >> K;

  int64 div = 1;
  int ans = 0;
  while (N / div > 0) {
    ans++;
    div *= K;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

double res;

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

    double N, K;
    cin >> N >> K;
    vector<double> p(N);
    vector<double> add(N, 0);
    double max = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
        p[i]++;
        p[i] /= 2;
    }
    add[0] = p[0];
    for (int i = 1; i < N; i++)
    {
        add[i] = p[i] + add[i - 1];
    }
    if(N==K){
        cout << fixed << setprecision(15) << add[N - 1] << endl;
        return 0;
    }
    for (int i = 0; i <= N - K; i++)
    {
        if (max < add[i + K] - add[i])
        {
            max = add[i + K] - add[i];
        }
    }
    cout << fixed << setprecision(15) << max << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(0)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define _ <<" "<<
const int MOD = 1000 * 1000  * 1000 + 7; // odd modulus
const int N = 1000 * 1000 ;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

ll gcd (ll a , ll b ) // b < a
{
return  b == 0 ?  a : gcd( b , a % b   ) ;

}
int main()
{
    Fast_IO();
    int n ;
    cin >> n ;
    vi ing ( n ,  0) ;
    for( int  &x : ing)
        cin >> x ;
    sort( all (ing)) ;
    float res =  (1.0 * ing[0] + ing [1] ) / 2 ;
    for( int i =  2 ; i < n ; ++i)
        res = ( 1.0 * res + ing[i]) / 2 ;
    cout << res ;
return 0 ;

}








Measured memory_bytes: 256
def main(): 
    n = int(input())
    a = [ int(x) for x in input().split() ]

    d = {}
    for aa in a:
        d[aa] = d.get(aa, 0) + 1

    if d.get(0, 0) == n:
        print("Yes")
        return 0
    L = sorted(list(d.items()))
    if n % 3 == 0 and len(L) == 2 and (L[0][0] == 0 and L[0][1] == n//3) and L[1][1] == n//3*2:
        print("Yes")
        return 0
    
    if n % 3 == 0 and len(L) == 3 and L[0][1] == n//3 and L[1][1] == n//3 and L[2][1] == n//3 and L[0][0]^L[1][0]^L[2][0] == 0:
        print("Yes")
        return 0

    print("No")

main()


Measured memory_bytes: 15908
#include <bits/stdc++.h>
using namespace std;
const int INF=300;

int main(){
  int h, w;
  cin >> h >> w;
  char hwmp[h][w];
  for(int i=0; i<h; ++i){
    for(int j=0; j<w; ++j){
      cin >> hwmp[i][j];
    }
  }
  vector<vector<int>> dp(h,vector<int>(w,INF));
  if(hwmp[0][0]=='.') dp[0][0] =0;
  else dp[0][0]=1;
  for(int i=0; i<h; ++i){
    for(int j=0; j<w; ++j){
      char x=hwmp[i][j], dx=hwmp[i][j-1], dy=hwmp[i-1][j];
      if(j){
        if(x=='.') dp[i][j] = min(dp[i][j], dp[i][j-1]);
        if(x==dx) dp[i][j] = min(dp[i][j], dp[i][j-1]);
        else dp[i][j] = min(dp[i][j], dp[i][j-1]+1);
      }
      if(i){
        if(x=='.') dp[i][j] = min(dp[i][j], dp[i-1][j]);
        if(x==dy) dp[i][j] = min(dp[i][j], dp[i-1][j]);
        else dp[i][j] = min(dp[i][j], dp[i-1][j]+1);
      }
    }
  }
  cout << dp.at(h-1).at(w-1) << endl;
}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;

string res;

int main()
{
    ll n;
    cin >> n;

    println(n / 3);

}


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

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> sum(n, 0);
  for(int i = 1; i < n; i++){
    if(s[i-1] == 'A' && s[i] == 'C'){
      sum[i] = sum[i - 1] + 1;
    }else {
      sum[i] = sum[i - 1];
    }
  }
  rep(i,q){
    int l, q;
    cin >> l >> q;
    l--, q--;
    cout << sum[q] - sum[l] << endl;
  }
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <vector>
#define MIN -12345678

struct str{
	int x0;
	int y0;
	int value;
};
std::vector<str> temp;
int DP[2010][2010];
int x[6010];
int max[2010];

int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=3*a;i++) scanf("%d",&x[i]);
	
	for(int i=1;i<=a;i++) for(int j=1;j<=a;j++) DP[i][j] = MIN;
	DP[x[1]][x[2]] = 0;
	DP[x[2]][x[1]] = 0;
	
	for(int i=1;i<=a;i++) max[i] = MIN;
	max[x[1]] = max[x[2]] = 0;
	int max0 = 0;
	int count = 0;
	
	for(int i=3;i<3*a;i+=3)
	{
		if(x[i]==x[i+1]&&x[i+1]==x[i+2]) count++;
		else
		{
			temp.clear();
			if(x[i]==x[i+1])
			{
				for(int j=1;j<=a;j++)
				{
					temp.push_back({j,x[i+2],DP[j][x[i]]+1});
					temp.push_back({x[i+2],j,DP[j][x[i]]+1});
				}
			}
			else if(x[i]==x[i+2])
			{
				for(int j=1;j<=a;j++)
				{
					temp.push_back({j,x[i+1],DP[j][x[i]]+1});
					temp.push_back({x[i+1],j,DP[j][x[i]]+1});
				}
			}
			else if(x[i+1]==x[i+2])
			{
				for(int j=1;j<=a;j++)
				{
					temp.push_back({j,x[i],DP[j][x[i+1]]+1});
					temp.push_back({x[i],j,DP[j][x[i+1]]+1});
				}
			}
			
			temp.push_back({x[i],x[i+1],DP[x[i+2]][x[i+2]]+1});
			temp.push_back({x[i+1],x[i],DP[x[i+2]][x[i+2]]+1});
			temp.push_back({x[i],x[i+2],DP[x[i+1]][x[i+1]]+1});
			temp.push_back({x[i+2],x[i],DP[x[i+1]][x[i+1]]+1});
			temp.push_back({x[i+2],x[i+1],DP[x[i]][x[i]]+1});
			temp.push_back({x[i+1],x[i+2],DP[x[i]][x[i]]+1});
			
			temp.push_back({x[i],x[i+1],max0});
			temp.push_back({x[i+1],x[i],max0});
			temp.push_back({x[i],x[i+2],max0});
			temp.push_back({x[i+2],x[i],max0});
			temp.push_back({x[i+1],x[i+2],max0});
			temp.push_back({x[i+2],x[i+1],max0});
			
			for(int j=1;j<=a;j++)
			{
				temp.push_back({j,x[i],max[j]});
				temp.push_back({x[i],j,max[j]});
				temp.push_back({j,x[i+1],max[j]});
				temp.push_back({x[i+1],j,max[j]});
				temp.push_back({j,x[i+2],max[j]});
				temp.push_back({x[i+2],j,max[j]});
			}
			
			for(int j=0;j<temp.size();j++)
			{
				int x0 = temp[j].x0;
				int y0 = temp[j].y0;
				int value = temp[j].value;
				if(DP[x0][y0]<value)
				{
					DP[x0][y0] = value;
					max0 = max0>value?max0:value;
					max[x0] = max[x0]>value?max[x0]:value;
					max[y0] = max[y0]>value?max[y0]:value;
				}
			}
			
		}
	}
	
	int max1 = DP[x[3*a]][x[3*a]]+1;
	printf("%d",(max0>max1?max0:max1)+count);
}

Measured memory_bytes: 19092
using System.Collections.Generic;
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}
public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var a = int.Parse(line[2]);
        var d = new Dictionary<int, P>();
        for (int i = 0; i < h; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < w; j++)
            {
                var ww = int.Parse(line[j]);
                d[ww] = new P { x = i + 1, y = j + 1 };
            }
        }
        var dd = new int[h * w + 1];
        for (int i = a+1; i <= h*w; i++)
            dd[i] = dd[i - a] + Math.Abs(d[i].x - d[i - a].x) + Math.Abs(d[i].y - d[i - a].y);
        var q = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < q; i++)
        {
             line = Console.ReadLine().Trim().Split(' ');
            var L = int.Parse(line[0]);
            var r = int.Parse(line[1]);
            Console.WriteLine(dd[r] - dd[L]);
        }
    }
}


Measured memory_bytes: 28988
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n;
vector < int > v,ans;
main () {
	cin>>n;
	
	while (n) {
		if (n%2==1) {
			n--;
			n/=2;
			v.pb(1);
		}
			else {
			n--;
			v.pb(0);
		}
	}
	
	reverse(v.begin(),v.end());
	
	for (int i=0; i<v.size(); i++) {
		if (v[i]) ans.pb(i+1);
			else {
			reverse(ans.begin(),ans.end());
			ans.pb(i+1);
			reverse(ans.begin(),ans.end());
		}		
	}
	
	for (int i=0; i<v.size(); i++)
		ans.pb(i+1);	

	cout<<ans.size()<<endl;
	for (int i=0; i<ans.size(); i++)
		cout<<ans[i]<<" ";	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int N,K;cin>>N>>K;
  std::vector<int> a(K),b(K);
  for(int i=0;i<K;i++)cin>>a[i]>>b[i];
  for(int i=0;i<K;i++){
    a[i]=min(a[i],N+1-a[i]);
    b[i]=min(b[i],N+1-b[i]);
    if(a[i]<=b[i]){
      if(a[i]%3)cout<<a[i]%3<<endl;
      else cout<<3<<endl;
    }
    else{
      if(b[i]%3)cout<<b[i]%3<<endl;
      else cout<<3<<endl;
    }
  }
}



Measured memory_bytes: 3096
using System;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            int A = cin.NextInt();
            int B = cin.NextInt();
            int C = cin.NextInt();
            int ans = 0;

            while(A%2==0 && B%2==0 && C % 2 == 0)
            {
                if(A==B && B == C)
                {
                    Console.WriteLine("-1");
                    return;
                }

                int a = A / 2;
                int b = B / 2;
                int c = C / 2;
                A = b + c;
                B = a + c;
                C = a + b;
                ans++;
            }

            Console.WriteLine(ans);
        }
    }
    class Scanner
    {
        string[] s;
        int i;

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

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

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

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

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

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

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

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


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

Measured memory_bytes: 27492
#include <stdio.h>

int p[1000001];

int main(){
  int n, i, j, c;
  p[0] = p[1] = 1;
  for(i = 2; i < 1000001; ++i){
    if(p[i] != 1)
      for(j = i * 2; j < 1000001; j += i)
	p[j] = 1;
  }

  while(scanf("%d", &n) && n){
    c = 0;
    for(i = 0; i <= n / 2; ++i)
      if(p[i] != 1 && p[n - i] != 1)
	c++;
    printf("%d\n", c);
  }
  return 0;
}

Measured memory_bytes: 4504
from collections import deque

N, M = map(int, input().split())
route = []
for i in range(M):
    route.append(list(map(int,input().split())))

island_map = {}
for a,b in route:
    if a not in island_map:
        island_map[a] = [b]
    else:
        island_map[a].append(b)

first_island = deque()
first_island += island_map[1]
second_island = deque()

for i in first_island:
    if i in island_map:
        second_island += island_map[i]
    else:
        pass
    for j in second_island:
        if j == N:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')



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

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

int lcm(int x,int y){
	return x*y/gcd(x,y);
}
 
signed main(){
	int n;
	cin>>n;
	int cnt;
	for(int i=0;n>0;i++){
		cnt+=n%10;
		n/=10;
	}
	if(cnt==1)cout<<10<<endl;
	else cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int N = sc.nextInt();
			int S = sc.nextInt();
			int W = sc.nextInt();
			int Q = sc.nextInt();
			if (N == 0 && S == 0 && W == 0 && Q == 0)
				break;
			int g = S;
			int[] a = new int[N];
			for (int i = 0; i < N; ++i) {
				a[N - 1 - i] = (g / 7) % 10;
				if (g % 2 == 0) {
					g = (g / 2);
				} else {
					g = (g / 2) ^ W;
				}
			}

			int[] seq = new int[N];
			long pow10 = 1;
			int zeropos = 0;
			HashMap<Integer, Integer> map = new HashMap<>();
			map.put(0, 1);
			int ans = 0;
			for (int i = 0; i < N; ++i) {
				if (Q != 2 && Q != 5) {
					seq[i] = (int) (((i > 0 ? seq[i - 1] : 0) + pow10 * a[i]) % Q);
					if (a[i] != 0 && map.containsKey(seq[i]))
						ans += map.get(seq[i]);
					map.put(seq[i], 1 + (map.containsKey(seq[i]) ? map.get(seq[i]) : 0));
					pow10 = pow10 * 10 % Q;
				} else {
					if (a[i] % Q == 0) {
						++zeropos;
					}
					if (a[i] != 0) {
						ans += zeropos;
					}
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 78584
S = input()

s = S.replace('keyence', '0')
lst = []
k = 'keyence'
jdg = False

if s[0] == '0' or s[-1] == '0':
    jdg = True
elif '0' in s:
    jdg = False
else:
    for i in range(1, len(k)):
        lst.append([k[:i], k[i:]])

    for i, j in enumerate(lst, start=1):
        if s[:i] == j[0] and s[i-7:] == j[1]:
            jdg = True
            break
if jdg: print('YES')
else: print('NO')


Measured memory_bytes: 9136
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    D = [V[i] - C[i] for i in range(N)]
    f = [d for d in D if d > 0]

    if len(f) == 0:
        print(0)
    else:
        print(sum(f))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
N = int(input())
A = [int(input()) for i in range(N)]


A_hash = {}
for i in range(N):
        if A[i] in A_hash:
                A_hash[A[i]] += 1
        else:
                A_hash[A[i]] = 1


A_max = max(A)
A_keys = list(A_hash.keys())
A_keys.sort()

if len(A_keys) > 1:
        A_second_max = A_keys[-2]
else:
        A_second_max = A_keys[-1]



for i in range(N):
        if A[i] == A_max:
                if A_hash[A_max] == 1:
                        print(A_second_max)
                else:
                        print(A_max)
        else:
                print(A_max)


Measured memory_bytes: 72660
#include <bits/stdc++.h>
// #include <iostream>
using namespace std;
typedef long long ll;
ll n, t, ans=INT_MAX, c, ti;
int main()
{
	cin >> n >> t;
	for(ll i = 0; i < n; i++)
	{
		cin >> c >> ti;
		if(ti > t)continue;
		ans = min(ans, c);
	}
	if(ans == INT_MAX)cout << "TLE\n";
	else cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

// ?¨???°????????? O(N+K)
// ??¶?´?: 0 <= v[i] <= v.size()
void counting_sort(vector<int> &v) {
	int n = v.size(), k = *max_element(v.begin(), v.end());
	vector<int> cnt(k + 1), tmp(v);
	cnt[0]--;
	for (int x : v)cnt[x]++;
	for (int i = 0; i < k; i++)cnt[i + 1] += cnt[i];
	for (int i = n - 1; i >= 0; i--) {
		v[cnt[tmp[i]]] = tmp[i];
		cnt[tmp[i]]--;
	}
}

signed main() {
	int n; cin >> n;
	vector<int> A(n); rep(i, 0, n) { cin >> A[i]; }
	counting_sort(A);
	cout << A[0]; rep(i, 1, A.size()) { cout << " " << A[i]; } cout << endl;
	return 0;
}

Measured memory_bytes: 18328
#include<bits/stdc++.h>
#define int long long   
#define mod 1000000009
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int pow(int p,int r){
	int ans=1;
	while(r>0){
     if(r&1){
		 ans=((ans%mod)*(p%mod))%mod;
	 }
	 r=r>>1;
     p=((p%mod)*(p%mod))%mod;
	}
	return ans;
}
signed main() {
	garou;
    int a,b,n;
	cin>>a>>b>>n;
	cout<<(a*min(b-1,n))/b;
}


Measured memory_bytes: 3600
use whiteread::parse_line;

fn main() {
    let (a, _b): (usize, usize) = parse_line().unwrap();
    let s: String = parse_line().unwrap();
    let mut s = s.as_str().chars();
    if s.position(|x| x == '-') == Some(a) && s.position(|x| x == '-').is_none() {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    int n,k;
    cin>>n>>k;
    int cnt=0;
    while(n>0){
        n=n/k;
        cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// 繰り返し二乗法 //////////

ll power(ll a,ll b){
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

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

int main(){
  ll M,K;
  cin>>M>>K;
  bool CAN=true;
  
  if(M<=1){
    if(K!=0) CAN=false;
  }
  else{
    if(K>=power(2,M)) CAN=false; 
  }
  
  if(CAN){
    if(M==1){
      co("0 0 1 1");
      return 0;
    }
    
    for(ll i=0; i<power(2,M); ++i){
      if(i!=K) cout<<i<<" ";
    }
    cout<<K<<" ";
    for(ll i=power(2,M)-1; i>=0; --i){
      if(i!=K) cout<<i<<" ";
    }
    cout<<K<<endl;
  }
  else co(-1);
  return 0;
}

Measured memory_bytes: 1792
import math

D,G = map(int,input().split())
d = [list(map(int,input().split())) for i in range(D)]

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a < G+b:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e <= 0:
            ans = min(ans,g)
        elif e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

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

void pok() {
  cout << "OK" << endl;
}
void png() {
  cout << "NG" << endl;
}

int main() {
  int N, K;
  cin >> N >> K;

  if (N % K == 0) cout << 0 << endl;
  else            cout << 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;

int main(){

    string s;
    cin >> s;

    int lower = 0;
    int c = 0;
    bool a = false;

    if(s[0] == 'A') a = true;

    for(int i = 2; i <= s.size() - 2; i++){
        if('C' == s[i]) c++;
    }

    for(int i = 0; i <= s.size() - 1; i++){
        if('a' <= s[i] && s[i] <= 'z') lower++;
    }

    bool ans = a && c == 1 && lower == s.size() - 2;

    cout << (ans ? "AC": "WA" ) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
#include <set>
#include <functional>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e4 + 7;

bool table[11000];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int W,H,x,y;cin>>W>>H>>x>>y;
    // inside
    int is_inside = 0;
    if(W%2==0 && H%2==0){
        int w = W/2;int h = H/2;
        if(w==x && h==y) is_inside = 1;
    }

    double ans = 1.*W*H/2.0;
    cout << fixed << setprecision(10) << ans;
    cout << " " << is_inside << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <map>
#include <algorithm>
using namespace std;

int main() {
	int N, X; cin >> N >> X;
	vector<int> L(N);
	for (int i = 0; i < N; i++) {
		cin >> L.at(i);
	}
	long long int D = 0, ans = 1;
	for (int i = 0; i < N; i++) {
		D += L.at(i);
		ans++;
		if (i != N - 1) {
			if (D + L.at(i + 1) > X) break;
		}
	}
	cout << ans << endl;
}

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

using namespace std;
 
#define eps (1e-10)
#define INF (1e20)

static const double PI = acos(-1);
bool eq(double a,double b){
  return ( -eps < a-b && a-b < eps);
}

class Point{
public:
  double x, y;
  Point ( double x = 0, double y = 0): x(x), y(y){}
  Point operator + ( Point p ){ return Point(x + p.x, y + p.y); }
  Point operator - ( Point p ){ return Point(x - p.x, y - p.y); }
  Point operator * ( double a ){ return Point(x*a, y*a); }
  Point operator / ( double a ){ return Point(x/a, y/a); }
};
typedef Point Vector;

class Segment{
public:
  Point p1, p2;
  Segment(Point s = Point(), Point t = Point()): p1(s), p2(t){}
  Vector base(){
    return p2-p1;
  }
};
typedef Segment Line;

bool eq(Point a,Point b){ return (eq(a.x,b.x)&&eq(a.y,b.y)); }
double norm( Vector a ){ return a.x*a.x + a.y*a.y; }
double abs( Vector a ){ return sqrt(norm(a)); }
double dot( Vector a, Vector b ){ return a.x*b.x + a.y*b.y; }
double cross( Vector a, Vector b ){ return a.x*b.y - a.y*b.x; }

bool isParallel(Vector a, Vector b){
  return eq(cross(a,b),0);
}

Vector unit(Vector v){
  if(eq(abs(v),0))return v;
  else return v/abs(v);
}

Point getCrossPoint(Line a,Line b){
  return a.p1+(a.p2-a.p1)*(cross(b.p2-b.p1,b.p1-a.p1)/cross(b.p2-b.p1,a.p2-a.p1));
} 

bool onSegment(Segment a,Point p){
  return eq( abs(a.p1-p)+abs(a.p2-p) , abs(a.p1-a.p2) );
}

bool intersect(Segment a,Segment b){
  if(isParallel(a.base(),b.base())){
    return (onSegment(a,b.p1)
            ||onSegment(a,b.p2)
            ||onSegment(b,a.p1)
            ||onSegment(b,a.p2));
  }
  Point p=getCrossPoint(a,b);
  
  return (onSegment(a,p)&&onSegment(b,p));
}

void scan(Segment &a){
  cin>>a.p1.x>>a.p1.y>>a.p2.x>>a.p2.y;
}

int main(){
  Segment a,b;
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    scan(a);
    scan(b);
    cout<<intersect(a,b)<<endl;
  }
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.141592653

ll a[200005];

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll x;
    for(int i=1;i<n;i++)
    {
        cin>>x;
        a[x]++;
    }
    for(int i=1;i<=n;i++)
        cout<<a[i]<<'\n';
    return 0;
}

Measured memory_bytes: 5080
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = min(b, d) - max(a, c);
	if (ans < 0)ans = 0;
	cout << ans << endl;
}



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

int main() {
    int s;
    cin >> s;

    int num = 0;
    if (s/100 == 1) ++num;
    if (s%100 /10 == 1) ++num;
    if (s%100 %10 == 1) ++num;
    cout << num;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int MAX = 1000001;
const int mod = 1000000007;
/* struct for mod Calculation*/
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 {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= 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 {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
vector<int> isPrime(MAX, 1);
vector<int> prime, a;
map<int, int> gcd;
int N;
/* function */
void eratos() {
    isPrime[0] = isPrime[1] = 0;
    for (int i = 2; i*i < MAX; i++) {
        if (isPrime[i]) {
            for (int j = i * 2; j < MAX; j += i) isPrime[j] = 0;
        }
    }
    for (int i = 0; i < MAX; i++) if (isPrime[i]) prime.push_back(i);
}

void primeFactorization() {
    for (int i = 0; i < N; i++) {
        map<int, int> factor;
        int x = a[i];
        if (x < 2) {
            factor[x]++;
            return ;
        }
        for (int j = 0; prime[j] * prime[j] <= a[i]; j++) {
            while (x%prime[j] == 0) {
                factor[prime[j]]++;
                x /= prime[j];
            }
        }
        if (x != 1) factor[x]++;

        for (auto f : factor) {
            gcd[f.first] = max(gcd[f.first], f.second);
        }
    }

}
/* main */
int main(){
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    eratos();
    primeFactorization();

    /*
    for (int i = 0; i < N; i++) {
        cout << a[i] << " : ";
        for (auto f : factor[i]) {
            cout << f.first << "^" << f.second << "*";
        } cout << '\n';
    }
    */

    mint L = 1;
    for (auto g : gcd) {
        mint b = g.first;
        L *= b.pow(g.second);
    }
    mint ans = 0;
    for (int i = 0; i < N; i++) {
        mint x = a[i];
        ans += L / x;
    }

    cout << ans << '\n';
}


Measured memory_bytes: 4988
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 3050;

int n;
int a[MAXN];
long long dp[MAXN][MAXN][2];

int main() {

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  for (int len = 1; len <= n; len++) {
    for (int i = 0; i + len <= n; i++) {
      int l = i, r = i + len - 1;
      for (int j = 0; j < 2; j++) {
        if (len == 1) {
          dp[l][r][j] = (j == 0 ? a[i] : -a[i]);
          continue;
        }
        long long x = dp[l + 1][r][1 - j] + (j == 0 ? a[l] : -a[l]);
        long long y = dp[l][r - 1][1 - j] + (j == 0 ? a[r] : -a[r]);
        if (j == 0) {
          dp[l][r][j] = max(x, y);
        } else {
          dp[l][r][j] = min(x, y);
        }
      }
    }
  }

  cout << dp[0][n - 1][0] << endl;

  return 0;
}


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

int main( )
{
    char c;
    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
        cout << "vowel\n";
    }
    else {
        cout << "consonant\n";
    }
    return 0;
}


Measured memory_bytes: 256
# 解説AC
class Combination():
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P
        # fact[i] = (i! mod P)
        self.fact = [1, 1]
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1]

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k): return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] * self.factinv[n-k] % self.P

#########################################
N,A,B,K = map(int, input().split())

MOD = 998244353
C = Combination(N, MOD)

ans = 0
for a in range(N+1):
    # bが整数 かつ 0<=b<=N
    if (K - a * A) % B == 0 and 0 <= (K - a * A) // B <= N:
        b = (K - a * A) // B
        ans = (ans + C.getComb(N, a) * C.getComb(N, b)) % MOD

print(ans)

Measured memory_bytes: 40956
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#define ll long long
#define pb push_back
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
#define cls(name,x) memset(name,x,sizeof(name))
using namespace std;
const int inf=1e9+10;
const ll llinf=1e16+10;
const int maxn=1e2+10;
const int maxm=1e2+10;
const int mod=1e9+7;
ll n;
ll A,B,C,D;
int main()
{
    //freopen("in.txt","r",stdin);
    while(~scanf("%lld %lld %lld %lld %lld",&n,&A,&B,&C,&D))
    {
        int flag=0;
        for(ll i=0;i<=n-1;i++)
        {
            ll low,high;
            low=C*i-D*(n-1-i);
            high=D*i-C*(n-1-i);
            if(B>=low+A&&B<=high+A)
            {
                flag=1;
                break;
            }
        }
        if(flag==1) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

RIGHT = "yuiophjklnm"


def solve(s):
    counter = 0
    prev = s[0] in RIGHT
    for c in s[1:]:
        now = c in RIGHT
        if prev != now:
            counter += 1
        prev = now
    return counter


if __name__ == "__main__":
    while True:
        s = input()
        if s == "#":
            break
        else:
            print(solve(s))

Measured memory_bytes: 7500
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()
	n, _ := strconv.Atoi(fmt.Sprintf("%d%d", a, b))
	ok := false
	for i := 1; i*i <= n; i++ {
		if i*i == n {
			ok = true
		}
	}
	if ok {
		puts("Yes")
	} else {
		puts("No")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
N = int(input())
x = [list(map(int, input().split())) for i in range(2)]
sum = 0
max = 0
for i in range(N):
    for k in range(i, N):
        sum += x[1][k]
    for j in range(i+1):
        sum += x[0][j]
    if max < sum:
        max = sum
    sum = 0
print(max)

Measured memory_bytes: 38640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

const int INF = 1 << 30;
const int MAXN = 2005;

int a[MAXN], b[MAXN];

int n, K, Q, L, R, P;

bool check(int D)
{
	for (int i = 1; i <= P; i++)
	{
		int X = b[i], Y = b[i] + D, cnt = 0, pre = 0, res = 0;
		for (int i = 1; i <= n + 1; i++)
		{
			if (a[i] < X)
			{
				int len = i - pre - 1;
				if (len >= K)
					res += min(cnt, len - K + 1);
				cnt = 0, pre = i;
			}
			else if (a[i] >= X && a[i] <= Y)
				cnt++;
			else
				continue;
		}
		if (res >= Q)
			return 1;
	}
	return 0;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> K >> Q;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		b[i] = a[i];
	sort(b + 1, b + n + 1);
	P = (unique(b + 1, b + n + 1) - b) - 1;
	int mn = INF, mx = 0;
	for (int i = 1; i <= n; i++)
		mn = min(mn, a[i]), mx = max(mx, a[i]);
	L = 0, R = mx - mn;
	a[n + 1] = 0;
	while (L < R)
	{
		int k = (L + R) >> 1;
		if (check(k))
			R = k;
		else
			L = k + 1;	
	}
	cout << L << endl;
	return 0;	
}


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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

int i[256];
int main()
{
	int n,k,an;
	cin>>n>>k;
	an=k;
	k--;n--;
	while(n-->0)an*=k;
	cout<<an<<endl;
	
	
}



Measured memory_bytes: 3568
x=int(input())

if x >=400 and x<=599:
    print("8")
elif x>=600 and x<=799:
    print("7")
elif x>=800 and x<=999:
    print("6")
elif x>=1000 and x<=1199:
    print("5")
elif x>=1200 and x<=1399:
    print("4")
elif x>=1400 and x<=1599:
    print("3")
elif x>=1600 and x<=1799:
    print("2")
else:
    print("1")


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define pob pop_back
#define ff first
#define ss second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define debug(x) cout << x << endl;
#define int long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace __gnu_pbds;
using namespace std;
using LD = long double;

const int N = 1e7+1;
const int mod = 1e9+7;
const int INF = 1e18;

void solve() {
	int h,w,k;
	cin >> h >> w >> k;
	char a[h][w];
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			cin >> a[i][j];
	int n = (int)pow(2,h);
	int m = (int)pow(2,w);
	unordered_map<int,bool> row,col;
	int ans = 0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			for(int p=0;p<h;p++) {
				if((i & (1<<p)) != 0)
					row[p] = true;
				else
					row[p] = false;
			}
			for(int p=0;p<w;p++) {
				if((j & (1<<p)) != 0)
					col[p] = true;
				else
					col[p] = false;
			}
			int cnt = 0;
			for(int x=0;x<h;x++)
				for(int y=0;y<w;y++)
					if(!row[x] and !col[y] and a[x][y] == '#')
						cnt++;
			if(cnt == k)
				ans++;
			row.clear();
			col.clear();
		}
	}
	cout << ans << endl;
}
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t = 1,i = 1;
    //cin >> t;
    while(t--) {
        //cout << "Case #" << i << ": ";
        solve();
        //i++;
    }
    return 0;
}


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


int n;
int a[4][13] = {};

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char c;
		int k;
		cin >> c >> k;
		k--;
		if (c == 'S')a[0][k] = 1;
		if (c == 'H')a[1][k] = 1; 
		if (c == 'C')a[2][k] = 1;
		if (c == 'D')a[3][k] = 1;
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			if (a[i][j] == 0){
				if (i == 0) cout << "S " << j + 1 << endl;
				if (i == 1)cout << "H " << j + 1 << endl;
				if (i == 2)cout << "C " << j + 1 << endl;
				if (i == 3)cout << "D " << j + 1 << endl;
			}
		}
	}
	return 0;
}




Measured memory_bytes: 3060
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

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

    ans = 0
    while N > 1:
        N -= (K - 1)
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14776
#include <cstdio>
#define rrep(i,n) for (int i = 1; i <= n; ++i)
using namespace std;

constexpr int MX = 100000, mod = 1000000007;
struct Fact {
  int d[MX+1];
  constexpr Fact(): d() {
    d[0] = 1;
    long long x = 1;
    rrep(i,MX) {
      x = (x*i)%mod;
      d[i] = x;
    }
  }
};
constexpr Fact F = Fact();

int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", F.d[n]);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m, q;
vector<vector<int>> vec;

void func(vector<int> vc, int num){
    if(num == n) {
        vec.push_back(vc);
        return;
    }
    for(int i = vc[vc.size()- 1]; i <= m; i++){
        vector<int> vc2 = vc;
        vc2.push_back(i);
        func(vc2, num + 1);
    }
}

int main(){
    cin >> n >> m >> q;
    vector<int> a(q),b(q),c(q),d(q), vc;
    rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    vc.push_back(1);
    func(vc, 1);
        
    int mx = 0;
    rep(i, vec.size()){
        vector<int> v = vec[i];
        int score = 0;
        rep(j, q){
            if(v[b[j]-1] - v[a[j]-1] == c[j]){
                score += d[j];
            }
        }
        chmax(mx,score);       
    }
    cout << mx << ln;
}


Measured memory_bytes: 6676
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>

const int MAXN = 1e5 + 5;

int n;
int tmp[MAXN], cnt;
long long int ans;
std::string s[MAXN];

int main() {
    std::cin >> n;
    for (int i = 1; i <= n; ++i) {
        std::cin >> s[i];
        std::sort(s[i].begin(), s[i].end());
    }
    std::sort(s + 1, s + n + 1);
    for (int i = 1; i <= n; ++i) {
        if (s[i] != s[i - 1])
            ++cnt;
        ++tmp[cnt];
    }
    for (int i = 1; i <= cnt; ++i) {
        ans += 1ll * tmp[i] * (tmp[i] - 1) >> 1;
    }
    std::cout << ans;
    return 0;
}

Measured memory_bytes: 7680