akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
from sys import stdin

ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


MOD = 10**9 + 7
H, W, K = ds_in()

dp = [[0, 0] for _ in range(W+2)]
dp[1][0] = 1

comb = [0] * 7
comb[0] = 1
comb[1] = 2
comb[2] = 3
for i in range(3, 7):
    comb[i] = comb[i-2] + comb[i-1]

for i in range(H):
    for i in range(1, W+1):
        dp[i][1] = dp[i][0] * (comb[max(0, i-2)] * comb[max(0, W-i-1)])\
                + dp[i-1][0] * (comb[max(0, i-3)] * comb[max(0, W-i-1)])\
                + dp[i+1][0] * (comb[max(0, i-2)] * comb[max(0, W-i-2)])
        dp[i][1] = dp[i][1] % MOD

    for i in range(1, W+1):
        dp[i][0] = dp[i][1]

print(dp[K][0])


Measured memory_bytes: 3064
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
 
int main(){
int a=read(),b=read(),i,j,ans=0;
for (i=1;i<=a;++i){
  if (i==a){
    for (j=1;j<=b;++j) if (j==a) ++ans;
    }
  else{
    if (i==1||i==3||i==5||i==7||i==8||i==10||i==12){
      for (j=1;j<=31;++j) if (j==a) ++ans;
	  }
	else if (i==2){
	  for (j=1;j<=28;++j) if (j==a) ++ans;
	  }
	else
	for (j=1;j<=30;++j) if (j==a) ++ans;
    }
  }
cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>

//by Skeef79

//НЕ ИСПОЛЬЗУЙ endl, есть свой en!!
//Иногда нужно не просто придумывать решение, а метматически расписать систему уравнений
//для задач с cin/cout в большом кол-ве - gnu , иначе вижуалки. А ваще пробуй два если TL

//для интерактивок - cout<<flush
// cin.tie и sync_with_stdio убирать для интерактивок

typedef long long ll;
typedef long double ld;

#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()

using namespace std;

const int INF = 1e9 + 1233;
const ll LINF = 1e18 + 1233;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
}

template <typename T> void Input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}


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

	ll a, b;
	cin >> a >> b;
	cout << max(max(a + b, a - b), a * b);


}





Measured memory_bytes: 256
#include<stdio.h>

#define N 100
#define WHITE 0
#define BLACK 1
#define INF 10000

int n;
int A[N][N];


int genericMST(){
  int x=0,min,min_i,min_j;
  int i,j,k;
  int cnt=0;
  int color[n];

  for(i=0;i<n;i++) color[i] = WHITE;

  color[0] = BLACK;
  cnt++;

  while(cnt<n){

    min = INF;
    min_i = min_j = -1;

    for(i=0;i<n;i++){
      if(color[i]==WHITE) continue;
    
      for(j=0;j<n;j++){
	if(A[i][j]!=-1 && min>A[i][j] && color[j]==WHITE){
	  // printf("ppp %d %d\n",A[i][j],color[j]);
	  
	  min = A[i][j];
	  min_i = i;
	  min_j = j;
	}
      }
    
    }

    // printf("%d %d | %d\n",min_i,min_j,min);

    x += min;
    color[min_j] = BLACK;
    cnt++;
    
  }
  
  return x;
}


int main(){

  int i,j;
  int x;
  
  scanf("%d",&n);

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

  x = genericMST();

  printf("%d\n",x);
  
  return 0;
}



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

int main() {
    char b;
    cin >> b;

    switch(b) {
        case 'A': cout << 'T' << endl; break;
        case 'T': cout << 'A' << endl; break;
        case 'C': cout << 'G' << endl; break;
        case 'G': cout << 'C' << endl; break;
        default: break;
    }
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    var flag = true
    var i = 0
    var count = 0
    while (flag) {
        flag = false
        for (j in n - 1 downTo i + 1) {
            if (a[j] < a[j - 1]) {
                var temp = a[j]
                a[j] = a[j - 1]
                a[j - 1] = temp
                flag = true
                count++
            }
        }
        i++
    }

    println(a.joinToString(" "))
    println(count)
}



Measured memory_bytes: 33944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		long ketasuu=1;
		long saidai =0;
		long kari=n;
		boolean hantei = true;

		while(true) {
			if(kari<10) {
				break;
			}
			kari=kari/10;
			ketasuu++;
		}

		for(int i=0;i<ketasuu-1;i++) {
			if(n%10!=9) {
				System.out.print(ketasuu*9-9+kari-1);
				hantei=false;
				break;
			}
			n=n/10;
		}
		if(hantei) {
			System.out.print(ketasuu*9-9+kari);
		}

	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> a, b, c;
vector<vector<ll> > dp(101000, vector<ll>(3));

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int A, B, C;
    cin >> A >> B >> C;
    a.push_back(A);
    b.push_back(B);
    c.push_back(C);
  }

  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;

  for (int i = 0; i < N; i++) {
    dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a[i];
    dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b[i];
    dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c[i];
  }

  cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;
  return 0;
}

Measured memory_bytes: 7148
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        double[] vList = ReadLineDoubleArray();
        Array.Sort(vList);
        double rtn = (vList[0] + vList[1]) / 2;
        for (int i = 2; i < n; i++) {
            rtn = (rtn + vList[i]) / 2;
        }
        Console.WriteLine(rtn);
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"};
    static int[] intArray = new int[10];
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private List<int> ReadLineIntList() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();}
    static private List<long> ReadLineLongList() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToList();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
  
    static private string IntToNString(int x, int n) {
        var nstring = "";
        var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
        int r = 1;
        int q = x;
        while (q > 0) {
            r = q % n;
            nstring += numbers[r];
            q = q / n;
        }
        return string.Join("",nstring.Reverse());
     }
}

Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>

using namespace std;

int a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 },k;

int main() {
	cin >> k;
	cout << a[k-1] << endl;
	return 0;
}

Measured memory_bytes: 384
n, m, rm, ans['   '];
int main() {
  scanf("%d%d", &n, &m);
  for (int x, y; n--;) {
    scanf("%d%d", &x, &y);
    int b = y + 1;
    for (int j = 1; j * j <= m; j++) {
      int tx = (x + j - 1) / j, ty = y / j;
      ans[tx]++;
      ans[ty + 1 < b ? ty + 1 : b]--;
      b = tx;
    }
    for (int i = 1; i < b; i++) {
      if ((x - 1) / i < y / i) {
        ans[i]++;
        ans[i + 1]--;
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    ans[i] += ans[i - 1];
    printf("%d\n", ans[i]);
  }
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		boolean isReverce = false;

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder sb = new StringBuilder(s);
		StringBuilder front = new StringBuilder();
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			int t = sc.nextInt();
			if (t == 1) {
				isReverce = !isReverce;
			} else {
				int f = sc.nextInt();
				// String c = sc.next();
				if ((f == 1 && !isReverce) || (f == 2 && isReverce)) {
					front.append(sc.next());
				} else {
					sb.append(sc.next());
				}
			}
		}
		sc.close();

		if (isReverce) {
			print(sb.reverse().toString() + front.toString());
		} else {
			print(front.reverse().toString() + sb.toString());
		}
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}

Measured memory_bytes: 127300
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{

ll a,b,c,d;
cin>>a>>b>>c>>d;
ll ss=(b-a+1);
ll s=ss;

a--;
ll k1=(b)/c-a/c;
ll k2=(b)/d-a/d;
ll h=(c*d)/gcd(c,d);
ll k3=(b)/h-a/h;



cout<<ss-k1-k2+k3;








}return 0;}

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

string S;

int main() {
	cin >> S;
	int n = S.size();
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (S[i] == '1') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
i = 1
alllist = []
while i < n+1 :
  a,b=map(str, input().split())
  c = [a ,int(b),i]
  alllist.append(c)
  i += 1
alllist.sort(key=lambda x:(x[0],-x[1]),reverse=True)
alllist.reverse()
j = 0
while j < n :
  print(alllist[j][2])
  j += 1

Measured memory_bytes: 3060
#include<stdio.h>


void Swap( int *a ,int *b )
{
	*a += *b ;
	*b = *a - *b ;
	*a = *a - *b ;
}

void Cut( int K ,int N ,int *num )
{
	N *= 2 ;

	int i ,j ;
	for( i = 1 ; i <= K ; ++i )
	{
		for( j = K - i + 1 ; j < N - i + 1 ; ++j )
		{
			Swap( num + j - 1 ,num + j ) ;
		}
	}
}

void reFulShuffle( int N ,int *num )
{
	int numB[ 200 ] ;

	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		numB[ i * 2 ] = num[ i ] ;
		numB[ i * 2 + 1 ] = num[ i + N ] ;
	}

	for( i = 0 ; i < N * 2 ; ++i )
	{
		num[ i ] = numB[ i ] ;
	}
}

void Choose( int K ,int N ,int *num )
{
	if( K == 0 )
	{
		reFulShuffle( N ,num ) ;
	}

	else
	{
		Cut( K ,N ,num ) ;
	}
}


int main( void )
{
	int N ;
	scanf( "%d" ,&N ) ;

	int M ,K ;
	scanf( "%d" ,&M ) ;

	int num[ 200 ] ;

	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		num[ i * 2 ] = ( i * 2 ) + 1 ;
		num[ i * 2 + 1 ] = ( i * 2 ) + 2 ;
	}
	
	for( i = 0 ; i < M ; ++i )
	{
		scanf( "%d" ,&K ) ;

		Choose( K ,N ,num ) ;
	}

	N *= 2 ;
	for( i = 0 ; i < N ; ++i )
	{
		printf( "%d\n" ,num[ i ] ) ;
	}

	return 0 ;
}


Measured memory_bytes: 2048
#include <stdio.h>
int main(void) {
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a==b){
  printf("%d\n",c);
}
if(b==c){
  printf("%d\n",a);
}
if(a==c){
  printf("%d\n",b);
}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef pair<int,int> pii;

signed main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  int ans=1;
  int c=0;
  for(i=n-1;i>0;i--)
    if(a[i]==a[i-1]){
      ans*=a[i];
      i--;
      c++;
      if(c==2)break;
    }
  if(c==2)cout<<ans<<endl;
  else cout<<0<<endl;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};

const int MOD = (int)1e9 + 7;
ll N, K;
int A[2000];
int L[2000], R[2000];    

signed main(){
    cin >> N >> K;
    REP(i, N) cin >> A[i];
    REP(i, N) L[i] = R[i] = 0;
    REP(i, N){
        FOR(j, 0, i) if(A[i] < A[j]) L[i]++;
        FOR(j, i + 1, N) if(A[i] < A[j]) R[i]++;
    }
    unsigned long long ans = 0;
    unsigned long long K_L = (K * (K + 1) / 2) % MOD;
    unsigned long long K_R = (K * (K - 1) / 2) % MOD;
    REP(i, N){
        ans = (ans + (K_L * L[i]) % MOD) % MOD;
        ans = (ans + (K_R * R[i]) % MOD) % MOD;
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
from sys import stdin

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

count = 0
flg = True
while flg:
    flg = False
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            A[j], A[j-1] = A[j-1], A[j]
            count += 1
            flg = True

print(*A)
print(count)


Measured memory_bytes: 5616
T = str(input())
T += "P"
ans = ""

# 末尾が"P"なら無条件でD, 末尾が"D"なら今見ている文字の次が"P"なら"D", "D"なら"P"

for i in range(len(T)-1):
    if i == 0 and T[i] == "?":
        if T[i+1] == "P":
            ans += "D"
        else:
            ans += "P"
    else:
        if T[i] == "?":
            if ans[-1] == "P":
                ans += "D"
            elif ans[-1] == "D":
                if T[i+1] == "P":
                    ans += "D"
                elif T[i+1] in ["D", "?"]:
                    ans += "P"
        else:
            ans += T[i]
print(ans)


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

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;

const D EPS = 1e-8;
const D PI = acos(-1);
//for vector
inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}

//rotate a point counter-clockwise on the origin
inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline int ccw(P a,P b,P c){
  b -= a;c -= a;
  if (cross(b,c)>EPS) return 1;   //counter clockwise
  if (cross(b,c)<-EPS) return -1; //clockwise
  if (dot(b, c)<-EPS) return 2;   //c--a--b on line
  if (abs(b)+EPS<abs(c)) return -2;   //a--b--c on line
  return 0;                       //on segment
}

inline bool is_cp(L a,L b){
  if(ccw(a.fs,a.sc,b.fs)*ccw(a.fs,a.sc,b.sc)<=0)
    if(ccw(b.fs,b.sc,a.fs)*ccw(b.fs,b.sc,a.sc)<=0)return true;
  return false;
}

inline D seg_p_dis(L a,P x){
  if(dot(a.sc-a.fs,x-a.fs)<EPS)return abs(x-a.fs);
  if(dot(a.fs-a.sc,x-a.sc)<EPS)return abs(x-a.sc);
  return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);
}

inline D seg_seg_dis(L a,L b){
  D res = 1e10;
  res = min(res,seg_p_dis(a,b.fs));
  res = min(res,seg_p_dis(a,b.sc));
  res = min(res,seg_p_dis(b,a.fs));
  res = min(res,seg_p_dis(b,a.sc));
  return res;
}

D g[111][111],d[111];
L starl[111][5];
P starv[111][5],c,p;
int n,m,l,x,y,a,r;
bool use[111];

int main(){
  while(scanf("%d%d%d",&n,&m,&l), n){
    for(int i=0;i<n;i++){
      scanf("%d%d%d%d",&x,&y,&a,&r);
      c = P(x,y), p = P(0,r);
      for(int j=0;j<5;j++)starv[i][j] = c+rotate(p,PI*(a+j*72)/180);
      for(int j=0;j<5;j++)starl[i][j] = L(starv[i][j],starv[i][(j+2)%5]);
    }

    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	D dis = 1e9;
	for(L a : starl[i]){
	  for(L b : starl[j]){
	    if(is_cp(a,b))dis = 0;
	  }
	}
	if(dis>EPS){
	  for(P a : starv[i]){
	    for(L b : starl[j])dis = min(dis, seg_p_dis(b,a));
	  }
	  for(P a : starv[j]){
	    for(L b : starl[i])dis = min(dis, seg_p_dis(b,a));
	  }
	}
	g[i][j] = g[j][i] = dis;
      }
      g[i][i] = 0;
    }

    for(int i=0;i<n;i++)d[i] = 1e9;
    d[m-1] = 0;
    memset(use,0,sizeof(use));

    for(;;){
      int v = -1;
      for(int u=0;u<n;u++){
	if(!use[u] && (v<0 || d[v] > d[u]))v = u;
      }

      if(v<0 || v==l-1)break;
      use[v] = 1;

      for(int u=0;u<n;u++){
	d[u] = min(d[u],d[v]+g[u][v]);
      }
    }

    printf("%.9lf\n",d[l-1]);
  }
}	

Measured memory_bytes: 1352
n = int(input())
encodes = [input() for _ in range(n)]
ans = 'Yes'
if len(set(encodes)) < n:
    ans = 'No'
    print(ans)
    exit()
for i in range(n-1):
    if encodes[i][-1] != encodes[i+1][0]:
        ans = 'No'
        break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}

// TODO: write
int main() {   
  int h,n;cin>>h>>n;
  vector<int> a(n),b(n);
  rep(i,n)cin>>a[i]>>b[i];
  vector<vector<int>> dp(n+10,vector<int>(h+10,INF));
  rep(i,n+10)dp[i][0] = 0;
  
  rep(i,n){
    rep(j,h+1){
      chmin(dp[i+1][j],dp[i][j]);
      chmin(dp[i+1][j],dp[i+1][max(j-a[i],0)]+b[i]);
    }
  }

  print(dp[n][h]);
  return 0;
}



Measured memory_bytes: 39808
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	printf("%lld\n",1ll*n*(n-1)/2);
}

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

int main() {
    int n;
    cin>>n;
    int arr[n];
    rep(i,0,n)
        cin>>arr[i];
    ll cash=1000,kabu=0;
    rep(i,0,n-1){
        if(arr[i]<=arr[i+1]){
            ll tmp=(cash/arr[i]);
            cash-=tmp*arr[i];
            kabu+=tmp;
        }else{
            cash+=kabu*arr[i];
            kabu=0;
        }
    }
    cash+=kabu*arr[n-1];
    cout<<cash<<endl;
}



Measured memory_bytes: 3628
#include <stdio.h>
int main(){
	int N,D,X,C;
	scanf("%d",&N);
	scanf("%d",&D);
	scanf("%d",&X);
	int A[N];
	for(int i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	C=0;
	for(int i=0;i<N;i++){
		//一人目は1,A[0]+1,2A[0]+1<=D//
		C = C + 1+ (D-1)/A[i]; 
	}
	printf("%d",C + X);
	return 0;
}

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

#define PI 3.14159265358979323846
#define int long long int
#define ff first
#define ss second
#define pb push_back

#define N 250010
#define MOD 1000000007

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;
    string s[n];int t[n];
    for (int i = 0; i < n; ++i)
    {
        cin >> s[i] >> t[i];
    }

    string x;
    cin >> x;

    int i = 0;
    for (; i < n; ++i)
    {
        if(s[i] == x)
            break;
    }
    i++;

    int ans = 0;
    while(i < n)
    {
        ans += t[i];
        i++;
    }

    cout << ans << "\n";
    return 0;   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
int val[1000001];
struct node {
	int x,v;
} a[1000001];
priority_queue<int,vector<int>,greater<int> > q;
bool cmp(const node &a,const node &b) {
	return a.v>b.v;
}
main() {
	int n=read(),m=read(),ans=0;
	for(int i=1; i<=n; i++)
		val[i]=read(),q.push(val[i]);
	for(int i=1; i<=m; i++)
		a[i].x=read(),a[i].v=read();
	sort(a+1,a+1+m,cmp);
	for(int i=1; i<=m; i++) {
		while(1) {
			int now=q.top();
			if(now<a[i].v)
				q.pop(),q.push(a[i].v),a[i].x--;
			if(!a[i].x||now>=a[i].v)
				break;
		}
	}
	while(!q.empty()) {
		ans+=q.top();
		q.pop();
	}
	cout<<ans;
}

Measured memory_bytes: 6772
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()
    B = LI()

    ans = 0
    for i in range(N):
        ans += min(A[i], B[i])
        B[i] -= min(A[i], B[i])
        ans += min(A[i+1], B[i])
        A[i+1] -= min(A[i+1], B[i])

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 26648
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int ans = 0;
	long long n,now,buffer;
	cin >> n>>now;
	now -= 1;
	for (int i = 1; i < n; i++)
	{
		cin >> buffer;
		if (buffer > now) now = buffer-1;
		else if (buffer == now) now = buffer;
		else
		{
			ans = 1;
			i = n;
		}
	}
	if (ans == 0) cout << "Yes";
	else cout << "No";
}

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

int main(){
    while(1){
        int N,K;
        cin>>N>>K;
        if(N ==  0 && K == 0) break;
        vector<long long> A(N);
        for(int i=0; i<N; i++) cin>>A[i];

        vector<long long> sum(N+1,0);
        for(int i=1; i<=N; i++){
            sum[i] = sum[i-1]+A[i-1];
        }

        long long ans=0;

        for(int i=0; i<=N-K; i++){
            ans = max(ans,sum[i+K]-sum[i]);
        }

        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 4324
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read


n,*ab = [int(i) for i in read().split()]

M = iter(ab)
d = {}

zero = 0
from math import gcd
for a,b in zip(M,M):
    if a==b==0:
        zero += 1
        continue
    g = gcd(a,b)
    a//=g
    b//=g
    if b < 0:
        a = -a
        b = -b
    if b==0 and a == -1:
        a = 1
    
    if a > 0:
        if (a,b) in d:
            d[(a,b)][0] += 1
        else:
            d[(a,b)] = [1,0]
    else:
        if (b,-a) in d:
            d[(b,-a)][1] += 1
        else:
            d[(b,-a)] = [0,1]
        


MOD = 1000000007
ans = 1

pow2 = [1]
for _ in range(200005):
    pow2.append(pow2[-1]*2%MOD)

#print(d)
for (a,b),(k,l) in d.items():
    ans *= pow2[k]+pow2[l]-1
    ans %= MOD


ans += zero-1
print(ans%MOD)




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

int main()
{
    int n;
    cin>>n;
    int a[n];
    float sum;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=1/(float)a[i];
    }
    float ssum=1/sum;
    printf("%0.5f\n",ssum);
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int N,i,j,flag=0;
  int A[200]={0};
  scanf("%d",&N);
  for(i=0;i<N;i++)
  {
  scanf("%d",&A[i]);
  }
  for(j=0;j<30;j++)
  {
  for(i=0;i<N;i++)
  {
  if(A[i]%2==1)
  {
    flag=1;
  }
    A[i]=A[i]/2;
  }
    if(flag==1)
    {
      printf("%d",j);
      return 0;
    }
  }
return 0;
}

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

int main() {
  int H,W;
  char OP = '0';
  string S1,S2,S3,S4;
  	cin >> H >> W;
  for(int k = 0;k < W;k++){
    S3 += ".";
    S4 += ".";
  }
    cin >> S1;//1 line
  for(int i = 0;i < H;i++){//input H-1 lines
    if(i < H-1)
      cin >> S2;
    else
      S2 = S4;
    for(int j = 0;j < W;j++){
    if(j >= 1){
      if(S1.at(j-1) == '#')//hidari
      OP++;
    }
    if(j+1 <= W-1){//migi
      if(S1.at(j+1) == '#')
       OP++;
    }
    if(S2.at(j) == '#')//sita
      OP++;
    if(j >= 1){
      if(S2.at(j-1) == '#')//hidarisita
      OP++;
    }
    if(j+1 <= W-1){//migisita
      if(S2.at(j+1) == '#')
      OP++;
    }
    if(S3.at(j) == '#')//ue
      OP++;
    if(j >= 1){
      if(S3.at(j-1) == '#')//hidariue
      OP++;
    }
    if(j+1 <= W-1){//migiue
      if(S3.at(j+1) == '#')
      OP++;
    }
    if(S1.at(j) == '.'){
     S1.at(j) = OP;
                       }
    OP = '0';
    }
    cout << S1 << endl;
    S3 = S1;
    S1 = S2;
                          }
  //最後のS2をつくって処理する
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	private static int[] k = new int[101];
	public void kami() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 100){
			for(int x = 1; x <= n; x++){
				 k[x] = sc.nextInt();
			}
			for(int i = n; i >= 2; i--){
				for(int j = n - 1; j >= 1; j--){
					if(j < i){
						int work = k[j];
						k[j] = k[i];
						k[i] = work;
					}
				}
			}
			for(int i = 1; i <= n - 1; i++){
				System.out.print(k[i] + " ");
			}
			System.out.println(k[n]);
		}
	}

	public static void main(String[] args) {

		new Main().kami();
	}

}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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; }

int main()
{
	int a, b, c;

	cin >> a >> b >> c;

	if (b + c > a)
		cout << c - (a - b) << endl;
	else
		cout << 0 << endl;


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

string s;
int k;

string solve() {
    int l = s.size();
    stringstream ss;
    for (int i = 0; i < l; i++) {
        int t = (s[i] == 'a'? 0 : 'z' - s[i] + 1);
        if (t <= k) {
            ss << 'a';
            k -= t;
        } else {
            ss << s[i];
        }
    }
    string res = ss.str();
    if (k > 0) {
        k %= 26;
        res[l-1] = 'a' + ((res[l-1]-'a'+k) % 26);
        //res[l-1] = (char)(res[l-1]+k);
    }
    return res;
}

void input() {
    cin >> s >> k;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define pb push_back


/* alias */


template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = 1000100010010010;
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alpha = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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; }




/* main */




signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int comb[51][51]; 
    rep(i,0,51){
        for(int j = 0; j <= i; j++){
            if(j == 0 or j== i){
                comb[i][j] = 1;
            }else{
                comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j]; 
            }
        }
    }


    int n, a, b; cin >> n >> a >> b;
    vi arr; 

    map<int, int> mp;
    rep(i,0,n){
        int t = input();
        arr.push_back(t);
        mp[t]++;
    }

    sort(all(arr));
    reverse(all(arr));

    map<int, int> use;
    rep(i,0,a){ 
        use[arr[i]]++;
    }




   
    double mxavg = (double)accumulate(arr.begin(), arr.begin() + a, 0LL) / a;


    printf("%08f\n", mxavg);


    int lst = arr[a - 1];
    int ans = 0;


    int detuse = use[lst];
    rep(i,a,b + 1){
        if(detuse > mp[lst]) break;
        

        ans += comb[mp[lst]][detuse];
        detuse++;

        if(*arr.begin() != lst) break;

    }

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


    




    
    
    

    



    






    



    





    


    

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
 int x, y;
 cin >> x >> y;

 if( -1000 <= x && y <= 1000 ){
 if( x > y ){
  cout << "a > b" << endl;
 }else if( x < y ){
  cout << "a < b" << endl;
 }else{
  cout << "a == b" << endl;
 }
 }

 return 0;
}

Measured memory_bytes: 3088
N, M = map(int, input().split())
N, M = min(N, M), max(N, M)
mod = 10**9+7

g1 = [1, 1]
for i in range(2, M+1):
    g1.append((g1[-1] * i) % mod)

if M-N > 1:
    print(0)
elif M-N == 1:
    print(g1[M]*g1[N] % mod)
else:
    print(g1[M]**2*2 % mod)


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

int main() {
  int a,b;
  cin >> b >> a;
  for(int i=a-b+1;i<=a+b-1;i++) {
    cout << i;
    if(i<a+b-1) {
      cout << " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
//   Rishabh Agarwal
#include <bits/stdc++.h>
#define F first
#define S second
#define MAX 10000003
using namespace std;

typedef long long int ll;
const ll mod = 1e9+7;
const ll INF= 1e18;
long double PI=3.1415926;

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll temp=power(a,b/2)%mod;
    if(b%2==0){
        return (temp*temp)%mod;
    }
    else{
        return ((a*temp)%mod*temp)%mod;
    }
}

ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

vector<ll>v;
vector<ll>::iterator it;
map<ll,ll>mp;

void primeFactors(ll n)  
{  
    while (n % 2 == 0)  
    {  
        mp[2]++;
        n = n/2;  
    }  
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
        while (n % i == 0)  
        {  
            mp[i]++;
            n = n/i;  
        }  
    }  
    if (n > 2){ 
        mp[n]++; 
    } 
}  

ll dp[3000][3000];

ll dp1(ll s,ll e,ll a[]){
    if(s>e){
        return 0;
    }
    else if(dp[s][e]!=-1){
        return dp[s][e];
    }
    else{
        dp[s][e] = max(a[s]-dp1(s+1,e,a),a[e]-dp1(s,e-1,a));
        return dp[s][e];
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    //cin>>t;
    t=1;
    //ll c=1;
    while(t--){
        ll n;
        cin>>n;
        ll a[n];
        for(ll x=0; x<n; x++){
            cin>>a[x];
        }
        memset(dp,-1,sizeof(dp));
        cout<<dp1(0,n-1,a)<<"\n";
        mp.clear();  
        v.clear();
        //cout<<"Case #"<<c<<": "<<ans<<"\n";
        //c++;
    }
    return 0;
}

Measured memory_bytes: 70784
#include <iostream>
using namespace std;
int fpb(int n, int m){
    if(m==0){
        return n;
    }
    else{
        return fpb(m, n%m);
    }
}
int main(){
    int n, k, arr[100005], temp, max=0;
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        cin >> arr[i]; 
        if(max<arr[i]){
            max=arr[i];
        }
    }
    temp=arr[1];
    for(int i=2; i<=n; i++){
        temp=fpb(temp, arr[i]);
    }
    if(k>=temp && k%temp==0 && k <= max){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var n = long.Parse(Console.ReadLine());


        var str = GetColumnName(n - 1).ToLower();

        Console.WriteLine(str);
    }

    private static string GetColumnName(long index)
    {
        string str = "";
        do
        {
            str = Convert.ToChar(index % 26 + 0x41) + str;
        } while ((index = index / 26 - 1) != -1);

        return str;
    }
}

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

int main() {
  int n;
   cin >> n;
   string s;
   cin >> s;
   int ans = 0;
rep(i,n-1) {
  if (s[i] != s[i+1]) ++ans;
}
  ans++;

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

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

int main()
{
    string s;
    int cnt = 0;
    cin >> s;
    for(int i = 0; i < s.size(); ++i)
    {
        if(s[i] == '2')cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
// ※※※ 解答不能 ※※※
// Um_nik氏
// https://atcoder.jp/contests/agc041/submissions/9179143
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int MOD;
const int N = 5010;
int n, dp[N];

int add(int x, int y){
    x += y;
    if(x >= MOD) return x - MOD;
    return x;
}

int main(){
    scanf("%d%d", &n, &MOD);
    dp[n] = 1;
    repr(p, n, 1){
        int z = p;
        z -= max(0, p - (n + 1) / 2);
        z -= max(0, p - n / 2 - 1);
        if(z <= 0) throw;
        repr(x, n, z + 1) dp[x - z] = add(dp[x - z], dp[x]);
    }
    int ans = 0;
    repx(i, 1, n + 1) ans = add(ans, dp[i]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
using namespace std;

int a[102][10002], f[10], n, m;

int calc(int f[10]){
	int ans = 0;
	for(int i = 0;i < m;i++){
		int res = 0;
		for(int j = 0;j < n;j++){
			if(f[j])res += !a[j][i];
			else res += a[j][i];
		}
		ans += max(res, n-res);
	}
	return ans;
}

int solve(int k, int b){
	if(k == n)return 0;
	int a[3];
	//for(int i = 0;i < 10;i++)f[i] = c[i];
	f[k] = b;
	a[0] = calc(f);
	a[1] = solve(k+1, 0);
	a[2] = solve(k+1, 1);
	sort(a, a+3);
	return a[2];
}

int main(){
	while(cin >> n >> m, n){
		for(int i = 0;i < n;i++)
		for(int j = 0;j < m;j++)cin >> a[i][j];
		int x, y;
		fill(f, f+10, 0);
		x = solve(0, 0);
		y = solve(0, 1);
		cout << max(x, y) << endl;
	}
	return 0;
}

Measured memory_bytes: 3436
// In The Name Of Allah
// Mehrkish Makuei

#include <bits/stdc++.h>

#define pb push_back
#define debug1(x) cerr << #x << " : " << x << endl;
#define debug2(x, y ) cerr << #x << " : " << x << "  " << #y << " : " << y << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef vector <ll> vll;
typedef set <char> sch;
typedef set <ll> sll;

const ll MOD = 1e9 + 7;
const ll MAXN = 1e3 + 19;

ll a, b;

int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if ( a != 1 and b != 1 ){
		if ( a > b )
			cout << "Alice" << endl;
		if ( a == b )
			cout << "Draw" << endl;
		if ( a < b )
			cout << "Bob" << endl;
		return 0;
	}
	if ( a == 1 and b == 1 ){
		cout << "Draw" << endl;
		return 0;
	}
	else if ( a == 1 or b == 1 ){
		if ( a == 1 and b != 1 )
			cout << "Alice" << endl;
		else if ( b == 1 and a != 1 )
			cout << "Bob" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
using namespace std;

int save[44]={};

int fibo(int n){
  if(n==0 || n==1) return 1;
  else if(save[n]==0){
    save[n]=fibo(n-1)+fibo(n-2);
    return fibo(n-1)+fibo(n-2);
  }
  else return save[n-1]+save[n-2];
}

int main(void){
  save[0]=1,save[1]=1;
  int N;
  cin >> N;
  cout << fibo(N) << endl;
}


Measured memory_bytes: 3136
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n, m;
int x[100005];

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

	sort(x, x + m);
	priority_queue<int> q;

	for (int i = 1;i < m;i++) {
		q.push(x[i] - x[i - 1]);
	}

	ll ans = 0;

	for (int i = 1;i < n;i++) {
		if (q.empty()) {
			cout << 0 << endl;
			return 0;
		}
		else {
			q.pop();
		}
	}
	
	while (!q.empty()) {
		ans += q.top();
		q.pop();
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1276
import sys
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    for a1, a2 in zip(A[:-k], A[k:]):
        if a1 < a2:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 31352
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define irep(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define rrep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

const int MOD = 1e9 + 7;

long long power(int n, int p) {
    if (p < 0)
        return 0;
    if (p == 0)
        return 1;

    long long dup = power(n, p / 2);
    dup *= dup;

    if (p % 2 == 1)
        dup *= n;
    return dup;
}


long long comb(int n, int r) {

    static long long dp[100][100] = { 0 };
    if (dp[n][r] != 0)
        return dp[n][r];
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= i; j++) {
            if (j == 0 || j == i)
                dp[i][j] = 1;
            else
                dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]);
        }

    return dp[n][r];

}


int main() {
    int n, p;
    cin >> n >> p;
    int num0 = 0, num1 = 0;
    rep(i, 0, n) {
        int a;
        cin >> a;
        a %= 2;
        if (a == 0)
            num0++;
        else
            num1++;
    }
    long long res = power(2, num0);
    if (p == 0) {
        long long accum = (num1 == 0 ? 1 : power(2, num1 - 1));
        res *= accum;
    }
    else {
        long long accum = (num1 == 0 ? 0 : power(2, num1 - 1));
        res *= accum;
    }

    cout << res << endl;



    return 0;

}


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

#define esp 1e-9

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n;
	cin>>n;
	int f=0;
	for(long long int i=2;i*i<=n;i++){
		if(n%i==0){
			f=1;
			break;
		}
	}
	if(f==0){
		long long int xxx=log10(n)+1+esp;
		cout<<xxx;
	}
	else{
		for(long long int i=sqrt(n)+1;i>=1;i--){
			if(n%i==0){
				long long int xx=n/i;
				long long int a=log10(i)+1+esp;
				long long int b=log10(xx)+1+esp;
				cout<<max(a,b);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3828
#include <stdio.h>

int main(){
  int a, b, total = 0, maior = -2147428648;
  scanf("%d %d", &a, &b);
  if(a == b)
    total = a+b;
  else{
    if(a < b)
      maior = b;
    else if(b < a)
      maior = a;
    total = maior + (maior-1);
  }
  printf("%d\n", total);
  return 0;
}


Measured memory_bytes: 128
S = input()
max = 0
ans = 0

for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
    ans += 1
    if ans > max:
      max = ans
  else:
    ans = 0

print(max)

Measured memory_bytes: 3064