akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
const ll  longinf = 1LL<<60;
const int mod=1000000007;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;
  cin>>n;
  ll a[3*n];
  rep(i,3*n)cin>>a[i];
  ll left[n+1],right[n+1];
  left[0]=right[n]=0;
  rep(i,n){
    left[0]+=a[i];
    right[n]+=a[2*n+i];
    }
  priority_queue<ll> ql;
  rep(i,n)ql.push(-a[i]);
  rep(i,n){
    left[i+1]=left[i]+a[n+i];
    ql.push(-a[n+i]);
    ll mil=ql.top();ql.pop();
    left[i+1]+=mil;
    }
  priority_queue<ll> qr;
  rep(i,n)qr.push(a[2*n+i]);
  rep(i,n){
    right[n-i-1]=right[n-i]+a[2*n-1-i];
    qr.push(a[2*n-1-i]);
    ll mir=qr.top();qr.pop();
    right[n-i-1]-=mir;
    }
  ll ans=-longinf;
  rep(i,n+1)ans=max(ans,left[i]-right[i]);
  cout<<ans<<endl;
  return 0;
  }
  
  


Measured memory_bytes: 5876
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define COUTDOUBLE(v) cout << std::setprecision(10)<<(v)<<endl;
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

class UnionFind {
public:
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool connect(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;
        }
        return x != y;
    }
    bool same(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)];
    }
};


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

    int N,M;cin >> N >> M;
    UnionFind Uni(N);
    for(int a= 0;a< M;a++){
        int b,c,d;cin >> b >> c >> d;
        Uni.connect(b-1,c-1);
    }
    int ans = 0;
    for(int a = 0;a < N;a++){
        if(Uni.data[a] < 0)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
#define int ll
const ll INF = 1e9 + 7;

ll n, q;
struct Node{
    ll s, t, x;
};
Node a[500000];
ll d[500000];

bool comp(Node A, Node B)
{
    return A.x < B.x;
}

ll ans[500000];

vector<int> start[500000];
vector<int> finish[500000];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> q;
    fill(ans, ans + q, INF);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].s >> a[i].t >> a[i].x;
    }
    sort(a, a + n, comp);
    for (int i = 0; i < q; i++)
    {
        cin >> d[i];
    }
    d[q] = 2 * INF;
    for (int i = n - 1; i >= 0; i--)
    {
        ll st = a[i].s - a[i].x;
        ll fn = a[i].t - a[i].x;
        int L = -1, R = q;
        while (L + 1 < R)
        {
            int M = (L + R) / 2;
            if (d[M] >= st)
            {
                R = M;
            }
            else
            {
                L = M;
            }
        }
        start[R].push_back(a[i].x);
        //cout << "start " << R << " " << a[i].x << endl;
        L = -1, R = q;
        while (L + 1 < R)
        {
            int M = (L + R) / 2;
            if (d[M] >= fn)
            {
                R = M;
            }
            else
            {
                L = M;
            }
        }
        finish[R].push_back(a[i].x);
        //cout << "finish " << R << " " << a[i].x << endl;
    }
    map<int, int> ans_gen;
    for (int i = 0; i < q; i++)
    {
        for (int j = 0; j < start[i].size(); j++)
        {
            ans_gen[start[i][j]]++;
        }
        for (int j = 0; j < finish[i].size(); j++)
        {
            ans_gen[finish[i][j]]--;
            if (ans_gen[finish[i][j]] == 0)
            {
                ans_gen.erase(finish[i][j]);
            }
        }
        if (ans_gen.size() == 0)
        {
            cout << "-1\n";
        }
        else
        {
            auto it = ans_gen.begin();
            pair<int, int> x = *it;
            cout << x.first << "\n";
        }
    }
}


Measured memory_bytes: 58472
a = []
a = gets.chomp.split("")
#p a
s =[]
a.each do |i|
    #p i
    if i == "S"
        #p i
        s.push(i)
    elsif i == "T"
        #p i
        if s[-1] == "T" || s.length == 0
            s.push(i)
        elsif s[-1] == "S"
            s.pop
        end
    end
end
#p s
puts s.length

Measured memory_bytes: 18428
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[105],sum[105],c[105];
int main()
{
   int n,a1,b1;
   scanf("%d",&n);
   memset(sum,0,sizeof(sum));
   memset(c,0,sizeof(c));
   for(int i=1;i<=n;i++)
   {
       scanf("%d",&a[i]);
       sum[i]=sum[i-1]+a[i];
   }
   for(int i=1;i<=n;i++)
   {
       a1=sum[n]-sum[i];
       b1=sum[i];
       c[i]=a1-b1;
   }
   int minn=100;
   for(int i=1;i<=n;i++)
   {    int t;
       if(c[i]>=0&&c[i]<=minn)
       {

           t=minn;
           minn=c[i];
           c[i]=t;
       }
       if(c[i]<0&&(-c[i])<=minn)
       {
           t=minn;
           minn=-c[i];
           c[i]=t;
       }
   }
   printf("%d\n",minn);
    return 0;
}


Measured memory_bytes: 128
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g




p = list(map(int,input().split()))
p.sort()

print(p[0]+p[1])







Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

void prime_factorization(s64 x, map<s64, int>& m)
{
    for (s64 i = 2; i * i <= x; ++i)
    {
        while (x % i == 0)
        {
            ++m[i];
            x /= i;
        }
    }
    if (x != 1) ++m[x];
}

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

    s64 n, m;
    cin >> n >> m;

    map<s64, int> f;
    prime_factorization(m, f);

    s64 dp[n + 1][31];
    rep (i, n + 1) rep (j, 31) dp[i][j] = 0;
    rep (i, n + 1) dp[i][0] = 1;

    rep (i, n)
    {
        for (int j = 1; j <= 30; ++j)
        {
            dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % MOD;
        }
    }

    s64 ans = 1;
    for (auto& x : f)
    {
        ans = ans * dp[n][x.second] % MOD;
    }

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



Measured memory_bytes: 24576
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, a;
  cin >> n >> a;
  int amari = n % 500;
  if (amari <= a) {
    cout << "Yes" << endl;
  } else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
import Control.Monad
import Data.List
import Data.Maybe
import Data.Bits
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B

query :: Int -> [Int] -> Int
query m = sum . map ((\n -> (n * (n-1)) `div` 2) . length) .
  group . sort
  . scanl' (\x y -> (x + y) `mod` m) 0 

main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine
  ais <- unfoldr (B.readInt . B.dropWhile (==' ')) <$> B.getLine
  putStrLn $ show $ query m ais

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

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

    int cnt =0;
    char tmp = s.at(0);
    for(int i=1; i<s.length(); i++){
        if(tmp != s.at(i)){
            cnt++;
        }
        tmp = s.at(i);
    }

    cout << cnt << endl;
    return 0;   
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a, b) for (int i = (a); i < (b); i++ )

typedef pair<int,int> P;
typedef long long ll;

const int INF = 100000000;
const double PI=3.14159265358979323846;


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


int main () {
    int N, X;
    cin >> N >> X;
    int x[N];
    rep(i,0,N) {
        cin >> x[i];
        x[i] = max(x[i]-X,X-x[i]);
    }

    int g = x[0];

    rep(i,1,N) {
        g = gcd(g,x[i]);
    }
    cout << g << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
                       ///****   Hasebul Hassan Chowdhury ***////
#define ms(a,v)        memset(a,v,sizeof a)
#define lll            long long
#define FOR(i,a,b)     for(int i=a;i<=b;i++)
#define fast           ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Read           freopen("input.txt", "r", stdin)
#define Write          freopen("output.txt", "w", stdout)
#define INF            99999999999999


void solve()
{
  int n;
  cin>>n;
  while(n>0)
  {
      if(n%10==7)
      {
          cout<<"Yes"<<endl;
          return;
      }
      n/=10;
  }
  cout<<"No"<<endl;


}

int main()
{
    fast
    #ifndef ONLINE_JUDGE
    //Read;
    //Write;
    #endif
    //sieve();
    //int cnt=1;
    //int t; cin>>t; while(t--) solve();
    solve();
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


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


int main() {
	ll t, a, b, c, d;
	cin >> t;
	for (int z = 0;z < t;z++) {
		cin >> a >> b >> c >> d;
		ll st = a - b;
		if (st < 0) {
			cout << "No" << endl;
			continue;
		}
		if (b > d) {
			cout << "No" << endl;
			continue;
		}
		ll g = gcd(b, d);
		ll  ccc = c - a % b, bbb = b - a % b;
		if (ccc < 0 && bbb>0) {
			cout << "No" << endl;
			continue;
		}
		if (g == 1) {
			if (bbb - ccc >= 2)cout << "No" << endl;
			else cout << "Yes" << endl;
			continue;
		}
		else {
			if (bbb%g != 0) {
				if (ccc/g < bbb/g) cout << "No" << endl;
				else cout << "Yes" << endl;
			}
			else {
				//cout << bbb << ' ' << ccc << ' '<<g << endl;
				if (bbb / g - ccc / g >= 2) {
					cout << "No" << endl;
				}
				else cout << "Yes" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, k;
int ans;
void solve(){
  cin >> n >> k;
  ans = 0;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    ans += min(x, abs(k-x));
  }
  cout << 2*ans << endl;
}

int main(){
  solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[1000001],c[1000001];
int main() {
	int b,sum=0,l=0;
	cin>>a;
	b=strlen(a);
	for(int i=b-1; i>=0; i--) {
		c[sum]=a[i];
		if(c[sum]=='b') c[sum]='d';
		else if(c[sum]=='d') c[sum]='b';
		else if(c[sum]=='p') c[sum]='q';
		else if(c[sum]=='q') c[sum]='p';
		sum++;
	}
	for(int i=0; i<=b-1; i++) {
		if(a[i]!=c[i]) {
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef long long ll;
const long long MOD = 1000000000 + 7;

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n, 0);
    priority_queue<ll> que;
    rep(i, n) {
        cin >> a[i];
        que.push(a[i]);
    }
    ll tmp;
    rep(i, m) {
        tmp = que.top();
        que.pop();
        que.push(tmp/2);
    }
    ll fee = 0;
    while (!que.empty()) {
        fee += que.top();
        que.pop();
    }
    cout << fee << endl;


    return 0;
}

Measured memory_bytes: 5084
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		
		a = sc.nextInt();
		b = sc.nextInt();
		
		if ( a < b ) {
			System.out.println("a < b");
		} else if ( a > b ) {
			System.out.println("a > b");
			
		} else {
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 17160
#include <iostream>

using namespace std;

unsigned long long xorsum(unsigned long long N)
{
  unsigned long long res;
  switch ((N + 1) % 4) {
    case 0:
      res = 0;
      break;
    case 1:
      res = 0 ^ N;
      break;
    case 2:
      res = 1;
      break;
    case 3:
      res = 1 ^ N;
      break;
  }

  return res;
}

int main()
{
  unsigned long long A, B;
  cin >> A >> B;

  cout << (xorsum(A - 1) ^ xorsum(B)) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define pb(x) push_back(x)
#define fi first
#define se second
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

signed main(){
	int n, x = 0, ans = 0;
	string str;
	cin >> n >> str;
	rep(i,n){
		if(str[i] == 'I')x++;
		else x--;
		chmax(ans, x);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define int long long
#ifdef ONLINE_JUDGE
const int maxn = 3e5 + 10;
#else
const int maxn = 1e3 + 10;
#endif
using namespace std;
int L;
signed main()
{
    ios::sync_with_stdio(false);
    cin >> L;
    int cnt = 0;
    while ((1 << (cnt + 1)) <= L) {
        ++cnt;
    }
    vector<vector<int>> edges;
    int V = 2;
    for (ri i = 1; i <= cnt; ++i) {
        edges.push_back({ V - 1, V, 0 });
        edges.push_back({ V - 1, V, 1 << (i - 1) });
        ++V;
    }
    V -= 1;
    int sub = L - (1 << cnt), fuck = 1 << cnt;
    for (ri i = 1; i < V; ++i) {
        if (sub & 1 << (i - 1)) {
            edges.push_back({ i, V, fuck });
            fuck += 1 << (i - 1);
        }
    }
    cout << V << " " << edges.size() << endl;
    for (auto e : edges) {
        cout << e[0] << " " << e[1] << " " << e[2] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
  int ans=0;
  int n;cin>>n;
  string s;cin>>s;
  for(int i=2;i<n;i++){
    if(s[i]=='C'){
      if(s[i-1]=='B'){
        if(s[i-2]=='A')ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m,tmp,cmp;
  cin >> n >> m;
  if(m%n==0){
    cout << m/n << endl;
    return 0;
  }
  tmp=m/n;
  cmp=m%n;
  while(1){
    if(cmp%tmp==0 and cmp>tmp){
      cout << tmp << endl;
      return 0;
    }
    cmp+=n;
    tmp--;
  }
  return 0;
}


Measured memory_bytes: 384
// Dont hack this or I hack ur mama
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#define ll long long 
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define EPS (1e-9)
using namespace std;

////////////// END OF TEMPLATE
const int nmax = 100100;
ll c[nmax],linear[nmax];
int n,a[nmax],m;
void read()
{
	cin >> n >> m;
	for(int i = 0 ; i < n; ++i)
	{
		cin >> a[i];
		--a[i];
	}
}
void add(int f0, int f1, int st, int end)
{
	c[st]+=f0;
	c[end]-=f0;
	linear[st]+=f1;
	linear[end]-=f1;
}
void solve()
{
	for(int i = 1; i < n; ++i)
	{
		int x = a[i-1], y = a[i];
		if( x < y )
		{
			add(y-x,  0,   0,   m);
			add(x+1,  0, x+1, y+1);
			add(  0, -1, x+1, y+1);
		}else if( x > y ){
			add(m-x+y,  0, y+1, m);
			add(  y+1, -1, 0, y+1);
			add(  x+1, -1, x+1, m);
		}
	}
	ll ans = 1e16;
	ll c0= 0 , c1 = 0;
	for(int i = 0; i < m; ++i)
	{
		c0+=c[i];
		c1+=linear[i];
		//cout << c0 << ' ' << c1 << endl;
		ans = min(ans,c0 + c1 * i);
	}
	cout << ans << endl;
}
int main()
{
	std::ios::sync_with_stdio(false);
	read();
	solve();
	return 0;
}


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

int main() {
 int A, B;
 int c=0;
 int d = B-A+1;
  cin >> A >> B ;
  rep(i, d) {
 if(i/10000 == i%10 && i/1000%10 == i/10%10){
 c++;
 }
 }
cout  << c << endl;
}

Measured memory_bytes: 256
//Coded by : devACE
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lld I64d
#define ii  pair<int,int>
int main()
{
    ios
    ll n,m,i,j,k,num,test=1;
    //freopen("input.txt","r",stdin);   //for reading from input.txt file
    //freopen("output.txt","w",stdout); //for writing in output.txt file
    //cin>>test;
    while(test--)
    {
      ll a,b;
      cin>>n>>a>>b;
      num=abs(b-a);
      if(num&1)cout<<"Borys";
      else cout<<"Alice";
    }
}



Measured memory_bytes: 256
mod = 10**9 + 7
n, k, *A = map(int, open(0).read().split())
if k == n:
    s = 1
    for a in A[:k]:
        s *= a
        s %= mod
    print(s)
elif k % 2 == 1 and all(a <= 0 for a in A):
    A.sort(key=abs, reverse=1)
    s = A.pop() % mod
    c = 1
    while c < k:
        t = A.pop() * A.pop() % mod
        s *= t
        s %= mod
        c += 2
    print(s)
else:
    A.sort(key=abs)
    pos_A = [a for a in A if a >= 0]
    neg_A = [a for a in A if a <= 0]

    if k % 2 == 1:
        s = pos_A.pop()
        c = 1
    else:
        s = 1
        c = 0
    while c < k:
        if len(pos_A) >= 2 and len(neg_A) >= 2:
            if pos_A[-1] * pos_A[-2] > neg_A[-1] * neg_A[-2]:
                t = pos_A.pop() * pos_A.pop() % mod
            else:
                t = neg_A.pop() * neg_A.pop() % mod
        elif len(pos_A) < 2:
            t = neg_A.pop() * neg_A.pop() % mod
        else:
            t = pos_A.pop() * pos_A.pop() % mod
        s *= t
        s %= mod
        c += 2
    print(s)

Measured memory_bytes: 31644
#include <iostream>
using namespace std;
int main(){
	int N,n[110]={},cnt=1,A,B,C,D;
	cin>>N;
	for(int i=0;i<N*(N-1)/2;i++){
		cin>>A>>B>>C>>D;
		if(C==D){
			n[A]+=1;
			n[B]+=1;
		}
		if(C>D){
			n[A]+=3;
		}
		if(D>C){
			n[B]+=3;
		}
	}
	for(int i=1;i<=N;i++){
		cnt=1;
		for(int j=1;j<=N;j++){
			if(i!=j && n[i]<n[j]){
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

int main(){
    int n; cin >> n;
    int a[n]; rep(i,n) cin >> a[i];
    int q; cin >> q;
    int b[q], c[q]; rep(i,q) cin >> b[i] >> c[i];
    map<int,int> count;
    rep(i,n) count[a[i]]++;
    ll sum = 0;
    for(auto v : count) sum += (ll)v.first*v.second;
    rep(i,q) {
        if (count[b[i]] != 0){
            int tmp = count[b[i]];
            count[c[i]] += tmp;
            count[b[i]] = 0;
            sum += (ll)(c[i] - b[i])*tmp;
        }
        cout << sum << endl;
    }
    return 0; 
}

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

int main() {
    int N, M, C, res=0, a, sum=0;
    cin >> N >> M >> C;

    int  B[M];
    for (int i=0; i<M; i++) cin >> B[i];
    for (int i=0; i<N; i++) {
            sum = 0;
            for (int k=0; k<M; k++) {
                cin >> a;
                sum += a * B[k];
            }
            if (sum + C > 0) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
N,M,p=gets.split.map &:to_i
d=M.times.map{gets.to_i}+[p]
d=(d+d.map{|i|i+N}).sort
p((M+1).times.map{|i|(r=d[i+M])-(l=d[i])+[l-p,r-p,l-p-N,r-p-N].map(&:abs).min}.min*100)

Measured memory_bytes: 6588
import java.io.*;
import java.util.*;

public class Main {
    
    class Answer {
        String A;
        String B;
        
        public boolean solve() {
            for (int i = 0; i < 3; i++) {
                char a = A.charAt(i);
                char b = B.charAt(2-i);
                if (a != b) return false;
                
            }
            return true;
        }
        
        public void main(FastScanner in, PrintWriter out) {
            A = in.next();
            B = in.next();
            out.println( solve() ? "YES" : "NO" );
        }
        
        public void p(Object o) { System.out.print(o); }
        public void pl(Object o) { System.out.println(o); }
        public void arp(int[] o) { pl( Arrays.toString(o) ); }
        public void arpp(int[][] o) { 
            for (int i = 0; i < o.length; i++) {
                for (int j = 0; j < o[0].length; j++) { p(o[i][j] + " "); }
                pl("");
            }
        }
        public void ck(Object o1, Object o2) { pl(o1 + " " + o2); }
        public void ckk(Object o1, Object o2, Object o3) { pl(o1 + " " + o2 + " " + o3); }
        public void ckkk(Object o1, Object o2, Object o3, Object o4) { 
            pl(o1 + " " + o2 + " " + o3 + " " + o4);
        }
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        
        Main problem = new Main();
        Answer ans = problem.new Answer();
        ans.main(in, out);
        
        out.close();
        in.close();
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); } 
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public String nextLine() {
            String str = "";
            try { str = br.readLine();
            } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
        public void close() throws IOException { br.close(); }
    }
}

Measured memory_bytes: 23380
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
#include<string>
using namespace std;
int main() {
	int n, m,ans=0;
	cin >> n >> m;
	ans += m * (m - 1) / 2;
	ans += n * (n - 1) / 2;
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    int x, n, t;    cin >> n >> x >> t;

    cout << (n+x-1)/x * t << endl;

    
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(int D, int T, int S, bool &ans){

    bool ans_buf;
    if(S*T < D) ans_buf = false;
    else ans_buf = true;

    ans = ans_buf;

    return;
}

int main(){

    int D, T, S;
    cin >> D >> T >> S;

    bool ans;
    solver(D, T, S, ans);

    if(ans) cout << "Yes"s << endl;
    else cout << "No"s << endl;

    return 0;
}


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

int main(){
  bool is_prime[50000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<=50000; i++){
    is_prime[i]=true;
  }

  for(int i=2; i*i<=50000; i++){
    if(is_prime[i]){
      for(int j=i*i; j<=50000; j+=i){
        is_prime[j]=false;
      }
    }
  }

  while(true){
    int n;
    cin >> n;
    int count=0;

    if(n==0)
      break;

    //if(n%2==0){
      for(int i=2; i<=n/2; i++){
        if(is_prime[i]){
          if(is_prime[n-i]){
            count++;
          }
        }
      }
    //}

    cout << count << endl;
  }

  return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>  // ver2.2.7
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,i) upper_bound(ALL(a),i)-lower_bound(ALL(a),i)
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(iY,0,a.size()){if(!a[iY].empty()){Verr(a[iY]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,m,q;
  cin >> n >> m >> q;
  VVi dia(n+1,Vi(n+1));
  int qw,er,ty,ui,sum = 0;
  rep(i,0,m){
    cin >> qw >> er;
    dia[qw][er]++;
  }
  rep(i,1,n+1){
    sum = 0;
    rep(j,1,n+1){
      sum += dia[i][j];
      dia[i][j] = dia[i-1][j]+sum;
    }
  }
  //VVerr(dia);
  int ans = 0;
  rep(i,0,q){
    cin >> qw >> er;
    ans = dia[er][er] + dia[qw-1][qw-1] - dia[er][qw-1] - dia[qw-1][er];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2944
input()

A = list(map(int, input().split()))

while len(A) != 1:
    A.sort()
    for i, a in enumerate(A):
        if i + 1 < len(A) and A[i + 1] >= a > 0:
            A[i + 1] %= a
    A = [a for a in A if a > 0]

print(min(A))


Measured memory_bytes: 63512
gets;puts ([[0,0,0]]+$<.map{|e|e.split.map &:to_i}).each_cons(2).all?{|e,f|
	t=f[0]-e[0];x=f[1]-e[1];y=f[2]-e[2]
	x+y<=t && (t-x-y)%2<1
} ? :Yes : :No

Measured memory_bytes: 10364
a,b,c,d = map(int,input().split())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

lcm_num = lcm(c,d)
c_num = (b//c - a//c) if a%c!=0 else (b//c - a//c + 1)
d_num = (b//d - a//d) if a%d!=0 else (b//d - a//d + 1)
ba_num = b//lcm_num - a//lcm_num if a%lcm_num!=0 else (b//lcm_num - a//lcm_num + 1)

if c == 1 or d == 1:
    print(0)
else:
    print(b-a+1-(c_num+d_num-ba_num) if b-a+1-(c_num+d_num-ba_num) > 0 else 0)

Measured memory_bytes: 3064
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


string f(llint n){
    if(n==0)return "";
    n--;
    return f(n/26)+string(1,'a'+(n%26));
}
void solve(){
    llint n;
    cin >> n;
    cout << f(n) << endl;
}

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




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

int main() {
  int n,k;
  cin >> n >> k;
  double ans;
  vector<double>data(n);
  for(int i = 0;i < n;i++){
    double p;
    cin >> p;
    if(i == 0) data[i] = (p+1)/2;
    else data[i] = (p+1)/2+data[i-1];
  }
  ans = data[k-1];
  for(int i = k;i < n;i++){
    if(ans < data[i]-data[i-k]) ans = data[i]-data[i-k];
  }
  std::cout << std::fixed;
  std::cout << std::setprecision(7) << ans << endl;;
}


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

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int k;
	string s;
	cin>>k>>s;
	int n = s.size();
	if (n > k){
		cout<<s.substr(0, k)+"...\n";
	}else{
		cout<<s<<'\n';
	}
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,m;
  cin>>a>>b>>m;
  int arra[100009];
  int arrb[100009];
  int x,y;
  for(int i=0;i<a;i++){
    int d;
    cin>>d;
    arra[i]=d;
    x=arra[0];}
    for(int i=0;i<a;i++){
    x=min(x,arra[i]);}
  for(int j=0;j<b;j++){
    int e;
    cin>>e;
    arrb[j]=e;
    y=arrb[0];}
    for(int j=0;j<b;j++){
    y=min(y,arrb[j]);}
  int l;
  int arrf[100009];
  int arrg[100009];
  int arrh[100009];
  for(int k=0;k<m;k++){
    int f,g,h;
    cin>>f>>g>>h;
    arrf[k]=f;
    arrg[k]=g;
    arrh[k]=h;  
  }
  l=arra[arrf[0]-1]+arrb[arrg[0]-1]-arrh[0];
for(int k=0;k<m;k++){
  l=min(l,arra[arrf[k]-1]+arrb[arrg[k]-1]-arrh[k]);
}

cout<<min(x+y,l);

  return 0;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool ok = false;
    char ss = s[0];
    REP(i, 1, 3) {
        if (ss != s[i]) {
            ok = true;
        }
    }
    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
def union(parent,size,a,b):
    x=find(parent,a)
    y=find(parent,b)
    if x!=y:
        if size[x]<size[y]:
            parent[x]=y 
            size[y]=size[x]+size[y]
        else:
            parent[y]=x 
            size[x]=size[x]+size[y]
    return parent,size 
def find(parent, a):
    while a != parent[a]:
            parent[a]=parent[parent[a]]
            a=parent[a]
    return a
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append([a,b,i])
l.sort(key=lambda x:x[0])
edges=[]
for i in range(1,n):
    edges.append([l[i][2],l[i-1][2],min(abs(l[i][0]-l[i-1][0]),abs(l[i][1]-l[i-1][1]))])
l.sort(key=lambda x:x[1])
for i in range(1,n):
    edges.append([l[i][2],l[i-1][2],min(abs(l[i][0]-l[i-1][0]),abs(l[i][1]-l[i-1][1]))])


parent=[i for i in range(n)]
size=[1]*n

edges.sort(key=lambda x:x[2])
cnt=0 
sm=0
for i in range(len(edges)):
    a=edges[i][0]
    b=edges[i][1]
    if find(parent,a)==find(parent,b):
        pass 
    else:
        parent,size=union(parent,size,a,b)
        sm+=edges[i][2]
        cnt+=1 
        if cnt==n-1:
            break 
print(sm)
parent=[i for i in range(n)]
size=[1]*n 


Measured memory_bytes: 113232
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
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 namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main ()
{
    int N;cin>>N;
    int res = N;
    REP(i,N+1){
        int cc =0;
        int t = i;
        while(t>0) cc+= t%6, t/=6;
        t = N-i;
        while(t>0) cc+= t%9, t/=9;
        if(res>cc){
            res = cc;
        }
    }
    cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

//#define MOD (int)(1e5 + 7)
#define MOD (100007)

void invalid(void)
{
	printf("-1\n");
	exit(0);
}

static inline int *readNint(int n)
{
	int *a = calloc(sizeof(int), n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	return a;
}

int main(int argc, char **argv)
{
	int H, A;
	scanf("%d%d", &H, &A);
	int t = H / A;
	if (H > (t * A))
		++t;
	printf("%d\n", t);
	return 0;
}


Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bOut(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp)
	sc.Split(bufio.ScanWords)
	n, m := iScan(), iScan()
	s := Scan()
	idx := n
	p := make([]int, 0, n)
	for idx != 0 {
		next := idx
		for i := smaller(idx, m); i > 0; i-- {
			if string(s[idx-i]) == "0" {
				next = idx - i
				break
			}
		}
		if next == idx {
			p = append(p, -1)
			break
		} else {
			p = append(p, idx-next)
			idx = next
		}
	}
	if p[len(p)-1] == -1 {
		fmt.Println(-1)
	} else {
		ans := make([]int, len(p))
		for i, v := range p {
			ans[len(p)-i-1] = v
		}
		iSSPrint(ans)
	}
}


Measured memory_bytes: 5840
n = int(input())
a = [int(i) for i in input().split()]

def f(a):
    for i in range(n):
        if a[i]%2 == 0 and not ( a[i]%3 == 0 or a[i]%5 == 0 ):
            return "DENIED"
    return "APPROVED"

print(f(a))

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

char a[3][128];

int main(void) {
	char *p[3], *np, pz;
	gets(a[0]);
	gets(a[1]);
	gets(a[2]);
	np = a;
	pz = 0;
	p[0] = a[0];
	p[1] = a[1];
	p[2] = a[2];
	while (1) {
		np = p[pz];
		p[pz]++; //向后移动一位
		if ((*np) < 'a' || (*np) > 'c') {
			break;
		}
		else {
			pz = (*np) - 'a'; //调整下一个的指针数组元素下标
		}
	}
	putchar('A' + pz);
	putchar('\n');

	//system("pause");
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int N,T,ans = 1000000000;
  scanf("%d %d",&N,&T);
  int c[N],t[N];
  for(int i = 0;i < N;i++){
    scanf("%d %d",&c[i],&t[i]);
    if(t[i] <= T && ans > c[i]){
      ans = c[i];
    }
  }
  if(ans == 1000000000){
    printf("TLE");
  }else{
    printf("%d",ans);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007

void solve()
{
    int n;cin>>n;
    int h[n];
    for(int i=0;i<n;i++)
        cin>>h[i];
    int dp[n];
    dp[0]=0;dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    cout<<dp[n-1]<<nl;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;
    //cin>>t;

    while(t--)
    {
      solve();
    }
    return 0;
}


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

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

    string a[50];
    rep(i, n){
        cin >> a[i];
    }
    string b[50];
    rep(i, m){
        cin >> b[i];
    }

    bool flag = false;
    bool check = false;
    rep(i, n-m+1){
        rep(j, n-m+1){
            check = true;
            rep(k, m){
                flag = false;
                if(!check) break;
                rep(l, m){
                    if(a[i+k][j+l] != b[k][l]){
                        flag = true;
                        break;
                    }
                }
                if(flag){
                    check = false;
                    break;
                }
            }
            if(check){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int e[300005];
int w[300005];
int main(){
    int n;
    string s;
    cin >> n >> s;
    for(int i=0;i<n;i++){
        w[i+1]=w[i]+(s[i]=='W');
        e[n-i-1]=e[n-i]+(s[n-i-1]=='E');
    }
    int ans=1e9;
    for(int i=0;i<n;i++){
        ans=min(ans,w[i]+e[i+1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string str;
    int R0, W0, C, R;

    while(true){
        cin >> R0 >> W0 >> C >> R;
        if(R0 + W0 + C + R == 0) break;
        //cout << R << endl;

        int ans;
        //if(R0 / W0 == C) ans = 0;
        //else{
            for(int X = 0;; X++){
                if((R0 + X * R) / C >= W0){
                    ans = X;
                    break;
                }//cout << X << endl;
            }
        //}
        cout << ans << endl;
        //if(Y >= C - W0 && Y < C + 1 - W0) cout << 0 << endl;

        //int X = (C(W0 + Y) - R0) / R;
        //int m = ; //追加するルウの最小値
        //m = min(m, X);
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

template <class T> T gcd(T x, T y) {
    // 最小公倍数を求める
    if (y == 0)
        return x;
    gcd(y, x % y);
}

template <class T> T lcm(T x, T y) {
    // 最大公約数を求める
    T GCD = gcd(x, y);
    T ans = x / GCD * y;
    return ans;
}

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

    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    for (auto &&i : v) {
        cin >> i;
    }

    auto yes = []() {
        print("POSSIBLE");
        exit(0);
    };
    auto no = []() {
        print("IMPOSSIBLE");
        exit(0);
    };

    int gc = v[0];
    for (auto &&i : v) {
        if (K == i) {
            yes();
        }
        gc = gcd(gc, i);
    }
    int k    = *max_element(ALL(v));
    int time = 1;
    while (0 <= k - time * gc) {
        if (k - time * gc == K)
            yes();
        time++;
    }
    no();

    return 0;
}

Measured memory_bytes: 640
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;

    return 0;
}



Measured memory_bytes: 256