akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using ull = unsigned long long;

int main(int argc, char* argv[]) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  /* */
  int n, k;
  cin >> n >> k;

  int ans = 1;
  for (int i = 0; i < n; ++i) {
    ans *= (i == 0 ? k : (k - 1));
  }
  cout << ans << endl;
  /* */

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int x = a.at(0);
    int y = a.at(n - 1);
    for (int i = 1; i < n; i++){
        if (abs(a.at(i) * 2 - x) < abs(y * 2 - x)){
            y = a.at(i);
            //cout << a.at(i) << endl;
        }
    }
    cout << x << " " << y << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main(void) {
    
    int ans=0;
    int n;
    string s;
    cin>>s;
    n=s.size();
    int l=0,r=n-1;
    while(l<r){
        if(s[l]==s[r]){
            // fin("a");
            l++;r--;
        } else if(s[r]=='x'){
            // fin("b");
            r--;
            ans++;
        } else if(s[l]=='x'){
            // fin("c");
            l++;
            ans++;
        } else {
            // fin("d");
            fin(-1);
            return 0;
        }
    }
    fin(ans);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,a[25],b,c[25],ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b);
		ans+=b;
	}
	for(int i=1;i<=n;i++)
		scanf("%d",&c[i]);
	for(int i=1;i<=n;i++)
		if(a[i]==a[i-1]+1&&a[i]!=1)
			ans+=c[a[i]-1];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    int n ;
    cin>>n;
    long long ans[10000];
    for(int i = 0; i < n; i++)
        cin>>ans[i];
    long long sums = 0;
    long long Max = 99999999999;
    for(long long i = -100;i<=100;i++)
    {
        sums=0;
        for(int j = 0;j < n;j++)
            sums+=(ans[j]-i)*(ans[j]-i);
        Max=min(Max,sums);
    }
    cout<<Max<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define INF 200000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
int A[MAX][MAX];
int d[MAX];
int color[MAX];
int n;

void dijkstra(){
  int u,i,v;
  int mincost;
  for(i=0;i<n;i++){
    d[i]=INF;
    color[i]=WHITE;
  }    
  d[0]=0;
  color[0]=GRAY;
  
  while(1){
    mincost=INF;
    u=-1;
      for(i=0;i<n;i++){
        if(color[i]!=BLACK && d[i]<mincost){
	  mincost = d[i];
	  u=i;
	}
      }  
  if(u==-1)break;
  color[u] = BLACK;
  for(v=0;v<n;v++){
    if(color[v]!=BLACK && A[u][v]!=INF){
      if(d[u]+A[u][v]<d[v]){
	d[v]=A[u][v]+d[u];
	color[v]=GRAY;
      }
    }
  }
  }
}


int main(){
  int i,j,u,k,c,v;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
	A[i][j]=INF;
    }
  }
    for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
	A[u][v]=c;
    }
    }
 dijkstra();
    for(i=0;i<n;i++){
      printf("%d %d\n",i,d[i]==INF ? -1:d[i]);
    }
    return 0;
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, o18 = 1000000000000000000, ans, tmp;
    bool iszero = false;
    cin >> n;
    vector<ll> A(n);
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
        if (A[i] == 0)
        {
            iszero = true;
        }
    }
    if (iszero)
    {
        cout << "0" << endl;
        return 0;
    }
    ans = A[0];
    for (int i = 1; i < n; i++)
    {
        tmp = o18 / ans;
        if (tmp < A[i])
        {
            ans = -1;
            break;
        }
        else
        {
            ans *= A[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3968
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import           Data.Ord
--import           Data.Vector.Algorithms.Search
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.IO                 as AIO



getvuil :: IO (VU.Vector Int)
getvuil = VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readi :: BSC8.ByteString -> Int
readi = fst . fromJust . BSC8.readInt
readil :: BSC8.ByteString -> [Int]
readil = map readi . BSC8.words
geti :: IO Int
geti = readi <$> BSC8.getLine
getil :: IO [Int]
getil = readil <$> BSC8.getLine

getNis :: Int -> IO [(Int, BSC8.ByteString)]
getNis 0 = return []
getNis n = do
    [aFst, aSnd] <- BSC8.words <$> BSC8.getLine
    next         <- (getNis (n - 1))
    return ((readi aFst, aSnd) : next)

il2ss :: [Int] -> String
il2ss = unwords . map show

il2sn :: [Int] -> String
il2sn = unlines . map show

modNum = 10 ^ 9 + 7
newtype Mint = M Int
instance Num Mint where
    (M a) + (M b) = M $ mod (a + b) modNum
    (M a) - (M b) = M (a - b)
    (M a) * (M b) = M $ mod (a * b) modNum
    fromInteger a = M $ mod (fromInteger a) modNum
    abs (M a) = M $ abs a
    signum (M a) = M $ signum a
instance Show Mint where
    show (M a) = show (mod a modNum)

mFromInt :: Int-> Mint
mFromInt a= M(mod a modNum)

main :: IO ()
main = do
    [aN, aK] <- getil
    aA       <- getvuil
    let
        invNum@(inv1, inv2) = foldl
            (\acc1@(a11, a12) x ->
                let
                    (r21, r22) = foldl
                        (\acc2@(a21, a22) y ->
                            if aA VU.! (x - 1) < aA VU.! (y - 1)
                                then (succ a21, a22)
                                else if aA VU.! (x - 1) > aA VU.! (y - 1)
                                    then (a21, succ a22)
                                    else (a21, a22)
                        )
                        (0, 0)
                        [x + 1 .. VU.length aA]
                in  (a11 + r21, a12 + r22)
            )
            (0, 0)
            [1 .. (VU.length aA) - 1]
    let sumLeft = (mFromInt( sum [1..(aK-1)]))
    let sumRight =( sumLeft + (M aK))
    trace
        ((show invNum)++" "++(show sumLeft)++" " ++ (show sumRight))
        $print
        (((M inv1) * (sumLeft)) + ((M inv2) * (sumRight)))





Measured memory_bytes: 49532
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>


using namespace std;


int main(void){
  
  unsigned long long N,M;
  int ans;
  
  cin >> N >> M;
  
  ans = N*(N-1)/2 + M*(M-1)/2;

 
  cout << ans << endl;

  return 0;
}



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

#define rep(i,a,b)                for(ll i=a;i<b;i++)
#define re(i,b)                for(ll i=0;i<b;i++)
#define repr(i,n)                for(ll i=n-1;i>=0;i--)
#define ll long long
#define ld long double
#define llu long long unsigned
#define pll std::pair<ll, ll> 
#define ppll std::pair<ll, pll>
#define vll std::vector<ll> 
#define vpll std::vector<pll> 
#define vppll std::vector<ppll> 
#define mll std::map<ll, ll> 
#define mpll std::map<pll, ll>
#define mppll std::map<ppll, ll>
#define sll std::set<ll>
#define ff first
#define ss second
#define msll std::multiset<ll>
#define all(c) c.begin(), c.end()
#define allr(c) c.rbegin(), c.rend()
#define srt(x) sort(all(x))
#define rsrt(x) sort(allr(x))
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define s(yy) ll yy;cin>>yy
#define mod 1e9+7
#define maxlong 1e18+5


/*
###################################################### 
#                                                    #
#                     @author                        #
#                  Parth Lathiya                     #
#      https://www.cse.iitb.ac.in/~parthiitb/        #
#                                                    #
###################################################### 
*/


int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef PARTH_LATHIYA_HOME

		freopen("D_in.txt","r",stdin);
	
		ll ttt,bkkk;
		cin>>ttt;
		bkkk=ttt;
		while(ttt--) {
			cout<<"Testcase - "<<bkkk-ttt<<"\n";
	#endif

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

	// std::vector<int> v[100];
	// std::vector<int> temp(100,4);
	// rep(i,0,100)
	// 	v[i] = temp;

	s(k);
	// 0 // 49 49 49
	// 1-49// 00 x
	// 50 // 50 50 50 50
	// 51-99 // follow

	// 100 // 51 51 51 
	// 100+50 // 52 52 52 
	// 150+50 // 53 53 53
	ll x,y,bk;
	if(k>=100)
	{
		k-=100;
		bk=k%50;
		k/=50;
		x=51+k;y=51+k;
		if(bk>25){
			bk=50-bk;
			x++;y++;
			while(bk--)
			{
				x++;
				y-=50;
			}
	
		}
		else{
			while(bk--)
			{
				x--;
				y+=50;
			}
		}
	}
	else
	{
		if(k>=0 && k<=49)
		{
			x=49;
			y=49;
			while(k--)
			{
				x--;y+=50;
			}
		}
		else if(k>=50 && k<=99)
		{
			x=50;
			y=50;
			k-=50;
			while(k--)
			{
				x--;y+=50;
			}
		}
	}
	cout<<"50\n";
	re(i,49)
		cout<<x<<" ";
	cout<<y;


//--------------------------------------------------------------------------------------
	
	#ifdef PARTH_LATHIYA_HOME
		cout<<"\n"; }
	#endif

	return 0;
}

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

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

    static class ASecurity {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            char[] a = s.next().toCharArray();
            boolean check = true;
            for (int i = 0; i < a.length - 1; i++)
                if (a[i] == a[i + 1])
                    check = false;

            if (check)
                w.println("Good");
            else
                w.println("Bad");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

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

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

        public String next() {
            return nextString();
        }

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

        }

    }
}



Measured memory_bytes: 22100
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

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

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// ((a+b)/2 + c)/2
int main() {
     int n;
     cin >> n;
     vector<double>v(n);
     for(int i = 0;i < n;i++){
         cin >> v[i];
     }
     sort(v.begin(),v.end());
     double ans = v[0];
     for(int i = 1;i < n;i++){
         ans = (ans + v[i])/2;
     }
     cout << ans;
}

Measured memory_bytes: 3808
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  a=list(map(int,input().split())) #横一列リスト
  ans=[0]*n
  for i in a:
    tmp=int(i)-1
    ans[tmp]=ans[tmp]+1
  for j in range(n):
    print(ans[j])
main()

Measured memory_bytes: 31100
#include <stdio.h>

int main(void){

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

  long toNext[n];
  for (long i = 0; i < n-1; i++) {
    toNext[i] = a[i+1] - a[i];
  }
  toNext[n-1] = k - a[n-1];
  toNext[n-1] += a[0];

  long max = toNext[0];
  for (long i = 1; i < n; i++) {
    if (toNext[i] > max) {
      max = toNext[i];
    }
  }

  long answer;
  answer = k - max;
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main(){
    int n,num[100];
    cin >>n;
    for(int i=0;i<n;i++)
        cin >> num[i];
    for(int i=n-1;i>=0;i--)
    {
        cout <<num[i];
        if(i>0)
            cout <<" ";
    }
    cout <<endl;
    return 0;
}


Measured memory_bytes: 3060
from heapq import heappop, heappush

n = int(input())
queue = []
for v in map(int, input().split()):
  heappush(queue, v)
for _ in range(n-1):
  v1 = heappop(queue)
  v2 = heappop(queue)
  heappush(queue, (v1 + v2) / 2)
print(queue[0])

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

int main(){
    int a, b ,c;
    cin >> a >> b >> c;
    int ta,tb;
    ta = max(a,b);
    tb = min(a,b);
    bool ok = false;
    for(int i= tb;i <= ta;i++){
        if(i == c){
            ok = true;
        }
    }
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from math import ceil

N = int(input())
ta, ao = 1, 1
for i in range(N):
    T, A = map(int, input().split())
    if ta <= T and ao <= A:
        ta = T
        ao = A
    else:
        if ta % T == 0:
            n = ta//T
        else:
            n = ta//T + 1
        if ao % A == 0:
            m = ao//A
        else:
            m = ao//A + 1
        
        ta = max(n, m) * T
        ao = max(n, m) * A
print(ta+ao)

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

using namespace std;

int n, m, k, ans, total, curr;
int matrix[6][6];
char x;

int main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;

    for(int i=0; i < n; ++i) {
        for(int j=0; j < m; ++j) {
            cin >> x;
            matrix[i][j] = (x == '#');
            total += matrix[i][j];
        }
    }

    for(int u=0; u < (1 << n); ++u) {
        for(int v=0; v < (1 << m); ++v) {
            curr = 0;

            for(int i=0; i < n; ++i) {
                for(int j=0; j < m; ++j) {
                    if(( ( (1 << i) & u) ) || ( ( (1 << j) & v) )) {
                        curr += matrix[i][j];
                    }
                }
            }

            if(total - curr == k) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
K = int(input())
A, B = map(int, input().split())
Frag = 0
for i in range(B-A+1):
  rod = i+A
  am = rod % K
  if am == 0:
    Frag = 1
    break
  else:
    pass
if Frag == 1:
  print("OK")
else:
  print("NG")

Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
    int n;
    cin >> n;
    int a;
    bool fl = true;
    rep(i,n){
        cin >> a;
        if(a%2==0 && (a%3!=0 && a%5!=0)) fl = false;
    }
    if(fl) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;

}

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

using namespace std;

#define INF 1000000000000LL

long long f(long long b, long long n)
{
    if (b > n) return n;
    else return f(b, n/b) + n % b;
}

int main()
{
    long long n, s;
    scanf("%lld%lld", &n, &s);
    if (n < s) {
        puts("-1");
        return 0;
    }
    if (n == s) {
        printf("%lld\n", n+1);
        return 0;
    }
    for (long long i = 2; i*i <= n; ++i) {
        if (f(i,n) == s) {
            printf("%lld\n", i);
            return 0;
        }
    }
    long long ans = INF;
    for (long long i = 1; i*i <= n; ++i) {
        long long l = n/(i+1)+1, r = n/i;
        while (l < r) {
            long long m = (l+r)/2;
            if (f(m,n) == s) {
                l = r = m;
            }
            else if (f(m,n) > s) {
                l = m+1;
            }
            else if (f(m,n) < s) {
                r = m-1;
            }
        }
        for (; f(l,n) < s && l >= n/(i+1)+1; --l);
        for (; f(l,n) > s && l <= n/i; ++l);
        if (f(l, n) == s) {
            ans = min(ans, l);
        }
    }
    if (ans == INF) {
        puts("-1");
    }
    else {
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main() {
    string s;
    getline(cin,s);
    int front = 0;
    int back = 0;
    front = stoi(s.substr(0,2));
    back = stoi(s.substr(2,4));
    if (0 < front && front < 13) {
      if (0 < back && back < 13) {
        cout << "AMBIGUOUS";
      } else if (back < 100 || back == 0) {
        cout << "MMYY";
      } else {
        cout << "NA";
      }
    } else if (front < 100 || front == 0) {
      if (0 < back && back < 13) {
        cout << "YYMM";
      } else {
        cout << "NA";
      }  
    } else {
      cout << "NA";
    }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main() 
{
    fast();
    ll n;
    cin>>n;
    ll a=0,b=0,c=0,d=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s=="AC")
            a++;
        else if(s=="WA")
            b++;
        else if(s=="TLE")
            c++;
        else
            d++;
    }
    cout<<"AC x "<<a<<nl;
    cout<<"WA x "<<b<<nl;
    cout<<"TLE x "<<c<<nl;
    cout<<"RE x "<<d<<nl;
}


Measured memory_bytes: 3616
S = list(input())

N = len(S)
re = 0
ro = 0
le = 0
lo = 0
ans = [0 for i in range(N)]

for i in range(N):
    if S[i] == 'R':
        if S[i+1] == 'L':
            if i%2 == 0:
                ans[i] += re+1
                ans[i+1] += ro
                re = 0
                ro = 0
            else:
                ans[i] += ro+1
                ans[i+1] += re
                re = 0
                ro = 0
        else:
            if i%2 == 0:
                re += 1
            else:
                ro += 1

for i in range(N-1,-1,-1):
    if S[i] == 'L':
        if S[i-1] == 'R':
            if i%2 == 0:
                ans[i] += le+1
                ans[i-1] += lo
                le = 0
                lo = 0
            else:
                ans[i] += lo+1
                ans[i-1] += le
                le = 0
                lo = 0
        else:
            if i%2 == 0:
                le += 1
            else:
                lo += 1

print(' '.join(map(str,ans)))

Measured memory_bytes: 11180
#include<bits/stdc++.h>
#define ll long long 
#define hell 1000000007
#define F first
#define re 15000000
#define S second
#define pb push_back
#define all(a)  (a).begin(),(a).end()
#define rep(i,a,b) for(ll int i = a;i<b;i++)
#define pi 3.1415926536
#define Mod 998244353
//char a[2000][2000];
using namespace std;
bool check(ll m,ll k,ll n,ll a ,ll b){
  ll rem = n-m;
  if( k > rem*b + a*m)
      return 1;
  else
    return 0;

}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);            
    //std::setprecision(20);    
    int tests=1;
      //freopen("input.txt", "r", stdin);   
    //cin>>tests;
  while(tests--)
    { 
      string s;
      cin>>s;
      map<char,int>m;
      for(int i = 0;i<s.size();i++)
          m[s[i]]++;
      if(m.size() == 2)
         cout<<"Yes";
      else
        cout<<"No"; 
    }
    
}

Measured memory_bytes: 764
#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, A;
    cin >> N;
    vector<bool> B(1000001, false), C(1000001, false);
    rep(i, N) {
        cin >> A;
        if (B[A]) {
            C[A] = true;
        }
        B[A] = true;
    }
    rep(i, 1000001) {
        if (B[i]) {
            for (int j = i * 2; j < 1000001; j += i) {
                C[j] = true;
            }
        }
    }
    int ans = 0;
    rep(i, 1000001) {
        if (B[i] && !C[i]) ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3884
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mp make_pair
  #define pb push_back
  #define inf INT_MAX
  #define f first
  #define s second
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define all(v) v.begin(), v.end()
  #define mod INT_MAX 
  const int MOD=1e9+7;
  const int N=2e5+2;

  
    
  int32_t main()
  {
    /*#ifndef ONLINE_JUDGE
       freopen("in.txt","r",stdin);
       freopen("out.txt","w",stdout);
    #endif*/
       IOS
       string s;
       cin>>s;
       int sum = 0;
       for(int i = 0 ;i<s.length();i++)
       {
        sum+=(s[i]-'0');
       }
       if(sum%9==0) cout<<"Yes";
       else cout<<"No";
        return 0;
  }
       

Measured memory_bytes: 3732
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define NDEBUG
#define debug(...)
#define IFD(...)
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <iostream>
#include <iomanip>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = static_cast<int>(a); i <= static_cast<int>(b); ++i)
#define FORD(i, b, a) for (int i = static_cast<int>(b); i >= static_cast<int>(a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

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

    int n, k;
    cin >> n >> k;
    vector pt(3, 0);
    cin >> pt[2] >> pt[1] >> pt[0];
    vector t(n, 0);
    rep(i, n)
    {
        char c;
        cin >> c;
        t[i] = (c == 'r' ? 2 : (c == 's' ? 1 : 0));
    }

    vector dp(n + k, vector(3, 0));
    rep(l, k)
    {
        for (int i = 0; l + k * i < n; ++i)
        {
            int j = l + k * i;
            rep(m, 3)
            {
                dp[j + k][m] = max(dp[j][(m + 1) % 3], dp[j][(m + 2) % 3]) + ((m - t[j] + 3) % 3 == 1 ? pt[m] : 0);
            }
        }
    }
    int ans = accumulate(dp.begin() + n, dp.end(), 0, [](int acc, vector<int> &v) {
        return acc + max({v[0],v[1],v[2]});
    });
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 13608
from fractions import gcd
from functools import reduce

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, *A = map(int, read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


x = reduce(merge, A)

if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)


Measured memory_bytes: 14504
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()
const long long mod = 1000000000 + 7;
const long long INF = 9e18;
const double PI = 3.14159265358979323846;

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


int main(){
    int A, B, M, ans;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);
    vector<int> X;
    vector<int> Y;
    vector<int> C;

    for(int i = 0; i < A; ++i) cin >> a[i];
    for(int i = 0; i < B; ++i) cin >> b[i];
    for(int i = 0; i < M; ++i){
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        X.push_back(x);
        Y.push_back(y);
        C.push_back(c);
    }
    ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
    for(int i = 0; i < M; i++){
        ans = min(ans, a[X[i]] + b[Y[i]] - C[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2412
A,B,K=map(int,input().split())
if B-A+1<=K:
    for k in range(B-A+1):
        print(A+k)
elif B-A+1>K :
    for i in range(K):
        print(A+i)
if K<B-A+1 and B-A+1<K*2:
    a=B-A+1
    b=K*2-a
    for i in range(K-b):
        print(B-(K-b)+1+i)
elif B-A+1>=K*2 :
    for j in range(K):
        print(B-K+j+1)


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

public class Main {

	
	void solve() {
		int n = in.nextInt(), m = in.nextInt();
		out.println((1L << m) * (1900 * m + 100 * (n - m))); 
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

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


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

int main(){
    int64_t N, K, Q, A, i;
    cin >> N >> K >> Q;

    vector<int64_t> att(N+1);
    for(i = 0; i < N+1; i++){
        att[i] == 0;
    }
    for(i = 0; i < Q; i++){
        cin >> A;
        att[A]++;
    }
    for(i = 1; i < N+1; i++){
        if(Q - att[i] < K)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;

int construct_tree(int v, vector<int>& as, vector<vector<int>>& tree)
{
	int h = as[v];
	int it = v + 1;

	while(it < (int)as.size() && h < as[it]) {
		tree[v].push_back(it);
		int n_it = construct_tree(it, as, tree);
		it = n_it;
	}

	return it;
}

int down(int from, int to, int v, int k)
{
	if(k == 1) return v;
	for(int i = 0; i < (from - to); ++i) {
		if(v == 1) return 1;
		v = (v + k - 1) / k;
	}
	return v;
}

int compute_values(int v, vector<int>& as, vector<vector<int>>& tree, int k)
{
	vector<pair<int, int>> buffer;

	for(int w_it = tree[v].size() - 1; w_it >= 0; --w_it) {
		int w = tree[v][w_it];
		int val = compute_values(w, as, tree, k);
		buffer.push_back({as[w], val});
	}

	while(buffer.size() > 1) {

		int sz = buffer.size();
		auto front = buffer[sz - 1];
		int fh = front.first, fv = front.second;
		auto next = buffer[sz - 2];
		int nh = next.first, nv = next.second;

		buffer.pop_back();
		buffer.pop_back();
		assert(fh >= nh);
		buffer.push_back({nh, down(fh, nh, fv, k) + nv});
	}

	if(buffer.size() > 0) {
		int fh = buffer[0].first;
		int fv = buffer[0].second;
		return down(fh, as[v], fv, k);
	} else {
		return 1;
	}
}

int main()
{
	int n;
	vector<int> as;

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

	vector<vector<int>> tree(n + 1);
	construct_tree(0, as, tree);

	int lo = 0, hi = 2 * n;

	while(hi - lo > 1) {

		int mid = (hi + lo) / 2;

		int val = compute_values(0, as, tree, mid);
		bool ok = (val <= 1);

		if(ok) {
			hi = mid;
		} else {
			lo = mid;
		}
	}

	int ans = hi;

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

	return 0;
}

/* waffle */


Measured memory_bytes: 36992
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

int main() {

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

	int N;
	cin >> N;

	vector<int> X(N);
	for (int i = 0; i < N; i++) cin >> X[i];

	int ans = INF;
	for (int i = 1; i <= 100; i++) {
		int tmp = 0;
		for (int j = 0; j < N; j++) {
			tmp += (X[j] - i)*(X[j] - i);
		}
		chmin(ans, tmp);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    int main(void){
    int i=1;
    int x;
    
    while(true){
        scanf("%d",&x);
        if(x==0){
        break;
        }
    printf("Case %d: %d\n",i,x);
    i++;
    }
    
    return 0;
    }


Measured memory_bytes: 2716
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  ll x;
  cin >> x;
  ll ans = 0;
  ll yen = 100;
  while(1){
    if(yen >= x) break;
    yen += yen/100;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3536
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define N 101000
vector<int> s[N];
vector<int> a[N];
int go(int u){
  int m=s[u].size();
  if (m==0)return 0;

  for (int i=0;i<m;i++){
    a[u].push_back(go(s[u][i]));
  }
  sort(a[u].begin(),a[u].end());
  int ret=0;
  for (int i=0;i<m;i++){
    ret=max(ret,a[u][i]+m-i);
  }
  return ret;
}
int main(){
  int n;
  scanf("%d",&n);
  for (int i=2;i<=n;i++){
    int x;
    scanf("%d",&x);
    s[x].push_back(i);
  }
  printf("%d\n",go(1));
  return 0;
}


Measured memory_bytes: 20608
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
int N;
vector<ll>S(1000000);
int Binary(int key) {
	int left = 0;
	int right = N;
	while (left < right) {
		int mid = (left + right) / 2;
		if (S.at(mid) == key) return 1;
		else if (key < S.at(mid)) right = mid;
		else left = mid + 1;
	}
	return 0;
}
int main() {
	int Q, K; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> S.at(i);
	}
	cin >> Q;
	int ans = 0;
	for (int i = 0; i < Q; i++) {
		cin >> K;
		if (Binary(K)) ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 10560
#include<bits/stdc++.h>
#define N 55
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
#define ll long long
using namespace std;
inline void in(int &x)
{
	x=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
}
bool edge[N][N];
ll dp[N][1<<20];
int state[N];
int n,m,fa[N],dep[N];
void dfs(int from,int f)
{
	fa[from]=f;
	dep[from]=dep[f]+1;
	for(int to=1;to<=n;++to)
	if(to!=f&&edge[from][to])
	dfs(to,from);
}
void LCA(int x,int y,int i)
{
	while(x!=y)
	{
		if(dep[x]<dep[y])swap(x,y);
		state[x]|=1<<i;
		x=fa[x];
	}
}
int main()
{
	in(n);
	for(int i=1;i<n;++i)
	{
		int x,y;
		in(x);in(y);
		edge[x][y]=edge[y][x]=1;
	}
	dfs(1,0);
	in(m);
	for(int i=0;i<m;++i)
	{
		int x,y;
		in(x);in(y);
		LCA(x,y,i);
	}
	dp[2][0]=1;
	for(int i=2;i<=n;++i)
	for(int mask=0;mask<(1<<m);++mask)
	{
		dp[i+1][mask]+=dp[i][mask];
		dp[i+1][mask|state[i]]+=dp[i][mask];
	}
	printf("%lld\n",dp[n+1][(1<<m)-1]);
	return 0;
}

Measured memory_bytes: 405048
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(X);
    INT(Y);
    INT(Z);

    cout << Z << " " << X << " " << Y << endl;
   
}

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

int n;
vector<int> a;

void input() {
    cin >> n;
    a = vector<int>(n);
    for(int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
}

void solve() {
    int max_pos = distance(a.begin(), max_element(a.begin(), a.end()));
    vector<pair<int, int>> v;
    for(int i = 0; i < n; i++) {
        v.push_back(make_pair(a.at(i), i));
    }
    sort(v.begin(), v.end(), [](auto a, auto b) {
            return a.first > b.first;
            });
    for(int i = 0; i < n; i++ ){
        if(i != max_pos) {
            cout << v.at(0).first << endl;
        } else {
            cout << v.at(1).first << endl;
        }
    }
    //cout << max_pos << endl;
    //for(auto e : v) {
    //    cout << e.first << ", "<< e.second << endl;
    //}

}
int main() {
    input();
    solve();
}


Measured memory_bytes: 4080
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var h = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        
        var ans = 0;

        while(true)
        {
            int i;
            for (i = 0; i < N; i++)
                if (h[i] > 0)
                    break;

            if (i == N)
                break;

            for (; i < N; i++)
            {
                if (h[i] > 0)
                    h[i]--;
                else
                    break;
            }

            ans++;
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 28296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
	int a,b; cin>>a>>b;
	int A=max(a,b),B=min(a,b);
	int ans=A;
	A--;
	//cout<<A<<endl;
	ans=ans+max(A,B);
	cout<<ans<<endl;
	
}


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

    ans1 = sum(A) - sum(a * 2 for a in A[1:n:2])
    ANS = [ans1]
    for i in range(n - 1):
        ANS.append((A[i] - (ANS[-1] // 2)) * 2)

    print(' '.join(map(str, ANS)))


if __name__ == '__main__':
    main()


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

int n, A[50];

int solve(int i, int m) {
  if (m == 0) return 1;
  if (i >= n) return 0;
  int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main() {
  int q, M, i;

  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &A[i]);
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &M);
    if (solve(0, M))
      printf("yes\n");
    else
      printf("no\n");
  }

  return 0;
}


Measured memory_bytes: 3124
h,w=map(int,input().split())

res=[]
for i in range(h):
	a=list(input())
	if a.count('.')==w:continue
	res+=list([a]) 
col=[True]*w
for i in range(len(res)):
	for j in range(w):
		if res[i][j]=='#':col[j]=False
		
for i in range(len(res)):
	for j in range(w):
		if col[j]==False:print(res[i][j],end='')
	print()


Measured memory_bytes: 4596
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <queue>
#include <cstring>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using ll = long long;


int main() {
  int N, T;
  int c[1001], t[1001];

  cin >> N >> T;
  for (int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
  }

  int ans = 100000;

  for (int i = 0; i < N; ++i) {
    if (t[i] <= T) {
      ans = std::min(c[i], ans);
    }
  }

  if (ans == 100000) {
    cout << "TLE" << endl;
  }
  else {
    cout << ans << endl;
  }

  return 0;
}

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

int main()
{
	int count=0;

	string str1, str2;
	cin>>str1>>str2;
	int n= str1.length();
for(int i=0;i<n;i++)
{
	if(str1[i] != str2[i])
		count++;
}
cout<<count;
	return 0;
}


Measured memory_bytes: 3884
open Hashtbl

let id x = x
let n = Scanf.scanf "%d\n" id
let h = create 100

let f n =
  let rec g n' =
    if n' = 0 then ()
    else
      let a = Scanf.scanf "%d " id in
      let v = try find h a with _ -> 0 in
      replace h a (v + 1) ;
      g (n' - 1)
  in
  g n


let () =
  f n ;
  fold (fun k v tmp -> 
      let v' = try find h (k - 1) with _ -> 0 in
      let v'' = try find h (k + 1) with _ -> 0 in
      max tmp (v + v' + v'')) h 0
  |> Printf.printf "%d\n"

Measured memory_bytes: 6912
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int zMIN(int a,int b){return a*b?MIN(a,b):a+b;}
int main(){
  int n,m,i,j,d[1000],c[1000],t[1000][1000]={0};
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d",&d[i]);
  for(i=0;i<m;i++)scanf("%d",&c[i]);
  for(i=0;i<m;i++){
    for(j=0;j<=i&&j<=n;j++){
      t[i+1][j]=zMIN(t[i+1][j],t[i][j]);
      t[i+1][j+1]=zMIN(t[i+1][j+1],t[i][j]+d[j]*c[i]);
    }
  }
  printf("%d\n",t[m][n]);
  return 0;
}

Measured memory_bytes: 4520