akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  const long long int Broken=1e10+1;
  while(cin>>n,n){
    vector<long long int> a(n);
    for(int i=0;i<n;i++){
      string buf; cin>>buf;
      if(buf=="x"){
	if(i%2==0) a[i]=-Broken;
	else a[i]=Broken;
      }	
      else a[i]=stoll(buf);

    }

    long long int lb=-1e9-3;
    long long int ub=1e9+3;
    for(int i=0;i<n && n>=2;i++){
      if(abs(a[i])==Broken){
	if(i==0){
	  ub=min(ub,a[i+1]-1);
	}
	else if(i==n-1){
	  if((n-1)%2==0){
	    ub=min(ub,a[i-1]-1);
	  }
	  else{
	    lb=max(lb,a[i-1]+1);
	  }
	}
	else{
	  if(i%2==0){
	    ub=min({ub,a[i-1]-1,a[i+1]-1});
	  }
	  else{
	    lb=max({lb,a[i-1]+1,a[i+1]+1});
	  }

	}
      }
      else{
	if(i+1<n&&abs(a[i+1])!=Broken){
	  if(i%2==0){
	    if(a[i+1]<=a[i]) lb=Broken;
	  }
	  else{
	    if(a[i+1]>=a[i]) lb=Broken;
	  }
	}
      }
      if(i!=0 && abs(a[i-1])==Broken && abs(a[i])==Broken){
	lb=Broken;
      }
      
    }

    if(lb==ub){
      cout<<lb<<endl;
    }
    else if(lb>ub){
      cout<<"none"<<endl;
    }
    else{
      cout<<"ambiguous"<<endl;
    }
    
  }
      

  return 0;
}

Measured memory_bytes: 2992
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int main(){
	int s[1000];
	int n;
	double m;
	double a;

	while(1){
		cin >> n;
		if(n==0) break;

		m = 0;
		for(int i=0; i<n; i++){
			cin >> s[i];
			m += s[i];
		}
		m /= n;	//m: average of s[i]
		
		a = 0;
		for(int i=0; i<n; i++){
			a += (s[i]-m)*(s[i]-m)/n;
		}
		printf("%.5f\n", sqrt(a));
	}
}

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

int main() {
  	string S, T;
  	cin >> S >> T;
  	int count = 0;
  	for (int i = 0; i < S.size(); i++){
      	if (S[i] != T[i]) count++;
    }
  	cout << count << endl;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  llong S;
  cin >> S;

  vector<llong> dp(S + 1, 0);
  dp[0] = 1;
  llong ans = 0;
  for (int i = 0; i <= S/3; i++) {
    vector<llong> res(S + 1, 0);
    for (int j = 3; j <= S; j++) {
      for (int k = j; k <= S; k++) {
        res[k] = (res[k] + dp[k - j]) % mod;
      }
    }

    ans = (ans + res[S]) % mod;
    swap(dp, res);
  }

  cout << ans << endl;

  return 0;
}


/*

dp[i][j] = 要素 i 個、総和が j の個数

*/

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0;
string s;
bool flag;
#pragma endregion

ll x[111111], v[111111], sm1[111111], smx1[111111], sm2[111111], smx2[111111];

int main(void) {
  ll c;
  cin >> n >> c;
  FOR(i, 1, n + 1) {
	cin >> x[i] >> v[i];
  }
  x[n + 1] = c;

  FOR(i, 1, n + 1) {
	sm1[i] = sm1[i - 1] + v[i] - (x[i] - x[i - 1]);
	smx1[i] = max(sm1[i], smx1[i - 1]);
	sm2[i] = sm2[i - 1] + v[n - i + 1] - (x[n - i + 2] - x[n - i + 1]);
	smx2[i] = max(sm2[i], smx2[i - 1]);
  }

  FOR(i, 1, n + 1) {
	ans = max(ans, sm1[i]);
	ans = max(ans, sm2[i]);
	ans = max(ans, sm1[i] + smx2[n - i] - x[i]);
	ans = max(ans, sm2[i] + smx1[n - i] - (c - x[n - i + 1]));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5120
import java.io.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solutionA(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solutionA(String[] args) throws Exception{

		int N = nextInt();
		int M = nextInt();
		char[][] A  = new char[N][N];
		char[][] B  = new char[M][M];
		for(int i=0;i<N;i++) {
			A[i]=nextString().toCharArray();
		}
		for(int i=0;i<M;i++) {
			B[i]=nextString().toCharArray();
		}

		for(int ny=0;ny<=N-M;ny++) {
			for(int nx=0;nx<=N-M;nx++) {
				boolean flg = true;

				for(int y=0;y<M;y++) {
					for(int x=0;x<M;x++) {
						if(A[ny+y][nx+x]!=B[y][x]) {
							flg=false;
							break;
						}
					}
					if(!flg) {
						break;
					}
				}
				if(flg) {
					pw.println("Yes");
					return;
				}
			}
		}
		pw.println("No");
	}



	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 23252
#include <stdio.h>

int main(void) {
	int N;
	if (scanf("%d", &N) != 1) return 1;
	if (N == 0) {
		puts("0");
	} else {
		int asumi = 0;
		int iguti[128];
		int tomatu = N;
		int sumipe = 1;
		int ayati;
		if (tomatu < 0) {
			tomatu = -tomatu;
			sumipe = -sumipe;
		}
		while (tomatu != 0) {
			if (asumi >= (int)(sizeof(iguti) / sizeof(*iguti))) {
				puts("ERROR!");
				return 2;
			}
			if (tomatu & 1) {
				tomatu -= sumipe;
				iguti[asumi++] = 1;
			} else {
				iguti[asumi++] = 0;
			}
			tomatu >>= 1;
			sumipe = -sumipe;
		}
		for (ayati = asumi - 1; ayati >= 0; ayati--) {
			printf("%d", iguti[ayati]);
		}
		putchar('\n');
	}
	return 0;
}


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

using namespace std;

int main() {

	long long n;
	cin >> n;

	long long m;
	m = (long long)pow(n, 0.5) + 1;
	long long k = 0;
	long long i;
	for (i = m; i >= 1; i--) {
		if (n%i == 0) {
			k = n / i;
			break;
		}
	}
	
	cout << i+k-2 << endl;
}

Measured memory_bytes: 512
abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

while True:
    n = int(input())
    if n == 0:
        break

    k = list(map(int, input().split()))
    s = str(input())
    for itr, c in enumerate(s):
        idx = abc[(abc.find(c) - k[itr % n] + 52) % 52]
        print(idx, end = "")
    print()


Measured memory_bytes: 5620
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr, tails, sort)
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS

isTriangle :: Int -> Int -> Int -> Bool
isTriangle a b c = a < b + c && b < c + a && c < a + b

naive = do
  n <- readLn :: IO Int
  xs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ length [ (a,b,c) | a:xss <- tails xs, b:xsss <- tails xss, c <- xsss, isTriangle a b c ]

-- v は昇順にソートされているとする。
-- count a v は a 以上の要素の個数を数える。
countGE :: Int -> U.Vector Int -> Int
countGE a v | U.null v = 0
            | U.length v == 1 = case compare a (U.head v) of
                                  LT -> 1
                                  EQ -> 1
                                  GT -> 0
            | otherwise = let n = U.length v
                              n2 = n `quot` 2
                          in case compare a (v U.! n2) of
                               LT -> countGE a (U.take n2 v) + n - n2
                               EQ -> countGE a (U.take n2 v) + n - n2
                               GT -> countGE a (U.drop n2 v)

main = do
  n <- readLn :: IO Int
  xs <- U.fromListN n . sort . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ sum [ countGE (c_min + 1) ys - countGE c_max ys
              | i <- [0..n-1]
              , let a = xs U.! i
              , j <- [i+1..n-1]
              , let b = xs U.! j
              , let c_min = max (a - b) (b - a)
              , let c_max = a + b {- c < a + b, b - a < c, a - b < c -}
              , let ys = U.drop (j+1) xs
              ]


Measured memory_bytes: 1148
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int max=0;
        int index=0;
        int pre=0;
        for(int i=0;i<n;i++){
            int a=sc.nextInt();
            if(pre>=a){
                index++;
            }
            else{
                max=Math.max(max,index);
                index=0;
            }
            pre=a;
        }
        max=Math.max(max,index);
        System.out.println(max);
    }
}


Measured memory_bytes: 48492
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n;
    while(cin>>n, n){
        bool now_ground=true;
        int lcnt=0, rcnt=0, ans=0;
        for(int i=0; i<n; i++){
            string f; cin>>f;
            if(f=="lu") lcnt++;
            if(f=="ru") rcnt++;
            if(f=="ld") lcnt--;
            if(f=="rd") rcnt--;

            if(now_ground && lcnt && rcnt){
                ans++;
                now_ground=false;
            }
            if(!now_ground && !lcnt && !rcnt){
                ans++;
                now_ground=true;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3096
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200010


int main() {
	int a[N];
	long long dp[N];
	long long b[N];
	f(i, N) {
		a[i] = 0;
		dp[i] = 0;
		b[i] = 0;
	}
	int n, k;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n) {
		scanf("%d", &a[i]);
	}
	b[a[0]]=1;
	f(i, n) {
		dp[i + 1] = b[a[i]];
		dp[i + 1] %= MOD;
		if (i < n - 1) {
			if (a[i] != a[i + 1]) {
				b[a[i + 1]] += dp[i + 1];
				b[a[i + 1]] %= MOD;
			}
		}
	}

	printf("%lld\n", dp[n]);


	return 0;
}

Measured memory_bytes: 4096
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double   ld;

#define  int                      long long 
#define  f(i,j,n)                 for(int i = j; i <= n; i++)
#define  r(i,n,j)                 for(int i = n; i >= j; i--)
#define  mod                      1000000007
#define  speed                    ios_base::sync_with_stdio(false);
#define  upp                      cin.tie(NULL);
#define  pb                       push_back
#define  pf                       push_front
#define  mp                       make_pair
#define  T                        int tttt; cin >> tttt; while(tttt--)
#define  ff                       first
#define  ss                       second
#define  all(container)           container.begin() , container.end()
#define  sz(container)            (int)container.size()
#define  pii                      pair <int , int>
#define  setp(x)                  setprecision(x)
#define  vi                       vector<int>
#define  pqb                      priority_queue<int>
#define  pqs                      priority_queue<int,vi,greater<int> >
#define  ook(x)                   order_of_key(x)
#define  fbo(x)                   find_by_order(x)

//#include <ext/pb_ds/assoc_container.hpp>   
//#include <ext/pb_ds/tree_policy.hpp>  
//#include <functional> 
//using namespace __gnu_pbds;  
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> OST;           //unique elements 

//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

signed main(){                                       //constraints , long long
     speed upp
     int n , k; cin >> n >> k;
     int arr[n+5] , sum = 0 , ans = 1;
     vector <int> v;
     f(i,1,n){
         cin >> arr[i];
         sum+=arr[i];
     }
     for(int i = 1; i*i <= sum; i++){
         if(sum%i == 0){
             v.pb(i);
             v.pb(sum/i);
         }
     }
     for(auto i : v){
         vector <int> rem;
         int add = 0 , sub = 0;
         f(j,1,n){
             rem.pb(arr[j]%i);
             add+=(i-(arr[j]%i));
         }
         sort(all(rem));
         for(auto j : rem){
             sub+=j;
             add-=(i-j);
             if(sub == add && add <= k){
                 ans = max(ans , i);
                 break;
             }
         }
     }
     cout << ans << '\n';
}

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

using namespace std;

typedef long long int lli;

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

    string s;

    cin >> s;

    for (int i=0; i<3; i++) {
        if (s[i] == s[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        print(f' {i}', end='')
    else:
        while x >= 1:
            if x % 10 == 3:
                print(f' {i}', end='')
                break
            x = x // 10
print()


Measured memory_bytes: 5880
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> as(n);
    long long sum=0;
    for(int i=0; i<n; ++i){
        cin >> as[i];
        sum+=as[i];
    }
    long long x=as[0];
    long long y=sum-as[0];
    long long ans=abs(x-y);
    for(int i=1; i<n-1; ++i){
        x+=as[i];
        y-=as[i];
        ans=min(ans, abs(x-y));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
program modulo_matrix
  implicit none
  integer, parameter :: m = 7919, k = 500
  integer :: n, u = 0, i, j
  integer(8) :: a(k,k) = 1_8, p(2*k) = 0_8
  logical :: b(m) = .false.
  read(*,*) n
  if (n == 2) then
    write(*,'(a)') "2 7"
    write(*,'(a)') "13 3"
    stop
  end if
  b(1) = .true.
  do i = 1, m
    if (b(i)) cycle
    do j = i, m, i
      b(j) = .true.
    end do
    b(i) = .false.
  end do
  do i = 1, m
    if (b(i)) cycle
    u = u+1
    p(u) = i
  end do
  do i = 1, n
    do j = 1, n
      u = i+j
      if (mod(u,2) == 0) a(i,j) = a(i,j)*p(u/2)
      u = i-j+n-1
      if (mod(u,2) /= mod(n,2)) a(i,j) = a(i,j)*p(2*n-(u+1)/2)
    end do
  end do
  do i = 1, n
    do j = 1, n
      if (a(i,j) /= 1_8) cycle
      if (i /= 1) a(i,j) = lcm(a(i,j),a(i-1,j))
      if (i /= n) a(i,j) = lcm(a(i,j),a(i+1,j))
      if (j /= 1) a(i,j) = lcm(a(i,j),a(i,j-1))
      if (j /= n) a(i,j) = lcm(a(i,j),a(i,j+1))
      a(i,j) = a(i,j)+1_8
    end do
  end do
  do i = 1, n
    write(*,'(i0)',advance='no') a(i,1)
    do j = 2, n
      write(*,'(x,i0)',advance='no') a(i,j)
    end do
    write(*,*)
  end do
contains
  integer(8) function lcm(a,b)
    integer(8), intent(in) :: a, b
    lcm = abs(a)/gcd(a,b)*abs(b)
  end
  integer(8) function gcd(a,b)
    integer(8), intent(in) :: a, b
    integer(8) :: x, y
    x = max(abs(a),abs(b))
    y = min(abs(a),abs(b))
    do while (y > 0_8)
      gcd = y
      y = mod(x,y)
      x = gcd
    end do
  end
end program modulo_matrix

Measured memory_bytes: 5120
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    if(n==1)
    {
        n=14;
    }
    if(m==1)
    {
        m=14;
    }
    if(n==m)
    {
        cout<<"Draw";
    }
    else if(n<m)
    {
        cout<<"Bob";
    }
    else
    {
        cout<<"Alice";
    }
    return 0;
}


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

using namespace std;

using ll = long long;

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

  int n;
  cin >> n;

  vector<array<int, 3>> activites(n);
  for (int i = 0; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    activites[i] = {a, b, c};
  }

  vector<vector<int>> dp(n + 1, vector<int>(3));

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + activites[i][j];
    }
  }

  cout << *max_element(dp[n].begin(), dp[n].end()) << '\n';

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos

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

  ll N, i;
  cin >> N >> i;

  cout << N - i + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		char op=scan.next().charAt(0);
		int b = scan.nextInt();
		scan.close();
		if(op=='+')System.out.println(a+b);
		else System.out.println(a-b);
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int N, H, W; cin >> N >> H >> W;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int A, B; cin >> A >> B;
        if (A >= H && B >= W) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int gcd(int large, int small)
{
    if (small == 0) return large;
    else if (large < small) gcd(large, small%large);
    else gcd(small, large%small);
}

int main()
{
    int A[2], small, large;
    int result;
    
    for(int i = 0; i < 2; i++) cin >> A[i];
    
    result = gcd(A[0], A[1]);
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 1160
import Control.Applicative ((<$>))
import Data.List (sort)


computeSum :: Integral a => [a] -> a
computeSum ps = (head qs `div` 2) + sum (tail qs)
    where qs = reverse $ sort ps


main :: IO ()
main = do
    ps <- tail . fmap read . lines <$> getContents :: IO [Int]
    print $ computeSum ps

Measured memory_bytes: 508
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, 0, n) cin >> h[i];
    reverse(h.begin(), h.end());

    bool ans = true;
    rep(i, 1, n)
    {
        if (h[i - 1] + 1 < h[i])
        {
            ans = false;
            break;
        }
        else if (h[i - 1] + 1 == h[i])
            h[i] = h[i - 1];
    }
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int d;
	cin>>d;
	int c[26];
	rep(i,26)cin>>c[i];
	int lastd[26]={};
	int s[d][26];
	rep(i,d){
		rep(j,26)cin>>s[i][j];
	}

	ll ans=0,maxi=0,maxid=0;
	ll ans2=0;
	ll t[d]={},greedy[d][26]={};
	rep(i,d){
		maxi=0;
		rep(j,26){
			ans=s[i][j];
			rep(k,26){
				if(k==j)continue;
				ans-=c[k]*(i+1-lastd[k]);
			}
			if(ans>maxi){
				maxi=ans;
				maxid=j;
			}
		}
		ans2+=maxi;
		lastd[maxid]=i+1;
		t[i]=maxid;
	}

	rep(i,d)cout<<t[i]+1<<endl;

	//cout<<"ss"<<ans2<<endl;

	return 0;
}


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

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

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

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

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

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

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

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

fn main(){

    input!{
        av: [i64;2],
        bw: [i64;2],
        t: i64,
    }

    let a = av[0];
    let v = av[1];
    let b = bw[0];
    let w = bw[1];

    let mut a_p = a;
    let mut b_p = b;

    let mut ans = "NO";
    for i in 0..t{
        if(a<b){
            a_p += v;
            b_p += w;
            if a_p >= b_p {
                ans = "YES";
                println!("{}", ans);
                return;
            }
        } else {
            a_p -= v;
            b_p -= w;
            if a_p <= b_p {
                ans = "YES";
                println!("{}", ans);
                return;
            } 
        }

    }
    println!("{}", ans);
}

Measured memory_bytes: 2164
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		//????????????????????????
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();

		//for (int i = 0; i < s.length(); i++) {
		//String str = s.substring(i, i + p.length());

		String str = s + s ;

		if(str.contains(p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 26160
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e8;

int main(){
	while(1){
		int n,m;
		cin >> n >> m;
		if(n==0) break;
		
		vector<vector<int> > adjL(n, vector<int>(n, inf)), adjS(n, vector<int>(n, inf));
		for(int i=0; i<m; i++){
			int x,y,t;
			char sl;
			cin >> x >> y >> t >> sl;
			x--; y--;
			if(sl=='L'){
				adjL[x][y] = adjL[y][x] = min(adjL[x][y], t);
			}else{
				adjS[x][y] = adjS[y][x] = min(adjS[x][y], t);
			}
		}
		for(int i=0; i<n; i++){
			adjL[i][i]=0;
			adjS[i][i]=0;
		}
		
		int r;
		cin >> r;
		vector<int> z(r);
		for(int i=0; i<r; i++){
			cin >> z[i];
			z[i]--;
		}
		
		for(int k=0; k<n; k++){
			for(int i=0; i<n; i++){
				for(int j=0; j<n; j++){
					adjL[i][j] = min(adjL[i][j], adjL[i][k]+adjL[k][j]);
					adjS[i][j] = min(adjS[i][j], adjS[i][k]+adjS[k][j]);
				}
			}
		}
		
		vector<vector<vector<int> > > dp(2, vector<vector<int> >(n, vector<int>(n, inf)));
		dp[0][z[0]][z[0]] = 0;
		for(int i=0; i<r-1; i++){
			for(int j=0; j<n; j++){
				for(int k=0; k<n; k++){
					dp[(i+1)%2][j][k] = inf;
				}
			}
			for(int j=0; j<n; j++){
				for(int k=0; k<n; k++){
					if(k==j){
						dp[(i+1)%2][z[i+1]][k] = min(dp[(i+1)%2][z[i+1]][k], dp[i%2][z[i]][j]+adjL[z[i]][z[i+1]]);
					}else{
						dp[(i+1)%2][z[i+1]][k] = min(dp[(i+1)%2][z[i+1]][k], dp[i%2][z[i]][j]+adjL[z[i]][j]+adjS[j][k]+adjL[k][z[i+1]]);
					}
				}
			}
		}
		
		int ans=inf;
		for(int i=0; i<n; i++){
			ans = min(ans, dp[(r-1)%2][z[r-1]][i]);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main() {
	int h,w,d,i,j;
	cin>>h>>w>>d;
	 int ma[h][w];
	 int a[h*w+1],b[h*w+1];
	for(i=0;i<h;i++)
	  {
	  	  for(j=0;j<w;j++)
	  	    {cin>>ma[i][j];
	  	       //cout<<ma[i][j];
	  	        a[ma[i][j]]=i+1;
	  	        b[ma[i][j]]=j+1;
	  	    }
	  }
	 long int q;
	 int x,y;
	 long int dis[h*w+1];
	 for(i=1;i<=h*w;i++)
	   {
	       if(i-d<=0)
	         dis[i]=0;
	       else
	         {
	         	dis[i]=dis[i-d]+abs(a[i]-a[i-d])+abs(b[i]-b[i-d]);
	         }
	   }
	 cin>>q;  
	 while(q--)
	   {
	   	   cin>>x>>y;
	   	   cout<<dis[y]-dis[x]<<"\n";
	   }
	// your code goes here
	return 0;
}

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

int main() {
int A, B;
  cin >> A >> B;
int a, b, c, d;
  c = B / 100 - A / 100;
  if ( A % 100 > ( A / 1000 - A / 10000 * 10 ) * 10 + A / 10000 ) {
    c--;
  }
  if ( B % 100 >= ( B / 1000 - B / 10000 * 10 ) * 10 + B / 10000 ) {
    c++;
  }
  cout << c << endl;
}

  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename TP>inline void read(TP &tar)
{
	TP ret=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){ret=ret*10+ch-'0';ch=getchar();}
	tar=ret*f;
}
namespace RKK
{
const int N=200011;
struct sumireko{int to,ne;}e[N];int he[N],ecnt;
void addline(int f,int t){e[++ecnt].to=t;e[ecnt].ne=he[f],he[f]=ecnt;}
int n,fa[N];
int rnd[N],ra,onr[N];
bool vis[N];
void findrnd()
{
	int x=1;
	while(!vis[x]) vis[x]=1,x=fa[x];
	while(!onr[x]) onr[x]=1,rnd[++ra]=x,x=fa[x];
}
int sg[N],sgvis[N],ipa;
void dfs(int x)
{
	for(int i=he[x],t=e[i].to;i;i=e[i].ne,t=e[i].to)if(!onr[t])
		dfs(t);
	ipa++;
	for(int i=he[x],t=e[i].to;i;i=e[i].ne,t=e[i].to)if(!onr[t])
		sgvis[sg[t]]=ipa;
	for(int i=0;;i++)if(sgvis[i]!=ipa){sg[x]=i;break;}
}

int Iris()
{
	read(n);for(int i=1;i<=n;i++) read(fa[i]),addline(fa[i],i);
	findrnd();
	int ma=-1,mi=n;
	if(ra&1)
	{
		for(int i=1,x=rnd[i];i<=ra;i++,x=rnd[i])
			dfs(x),ma=max(ma,sg[x]),mi=min(mi,sg[x]);
		puts(ma==mi?"IMPOSSIBLE":"POSSIBLE");
	}else puts("POSSIBLE");
	return 0;
}
}
int main(){return RKK::Iris();}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll n,m,q;
ll a[100],b[100],c[100],d[100];
ll mx;
ll x[100];
void build(ll idx,ll last)
{
    if(idx==n+1)
    {
        ll now=0;
        for(ll i=1; i<=q; i++)
        {
            if(x[b[i]]-x[a[i]]==c[i])
            {
                now+=d[i];
            }
        }
        mx=max(mx,now);
        return;
    }
    x[idx]=last;
    build(idx+1,last);
    for(ll i=1; i<=m; i++)
    {
        if(last+i<=m)
        {
            x[idx]=last+i;
            build(idx+1,last+i);
        }
    }
    return;
}
main()
{
    fast;
    cin>>n>>m>>q;
    for(ll i=1; i<=q; i++)
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    build(1,1);
    cout<<mx;
}



Measured memory_bytes: 3660
#include <set>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;

const int maxn = 1e5;

int pos[maxn + 11];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		pos[x] = i;
	}
	set <int> s;
	set <int> ::iterator itl, itr;
	s.insert(0); s.insert(n + 1);s.insert(n + 2);s.insert(-1);
	ll ans = 0;
	for (int i = n; i >= 1; i--) {
		itl = s.lower_bound(pos[i]); itr = itl--;
		int l = *itl;
		int r = *itr;
		if (l == 0) {
			itr++;
			int R = *itr;
			if (r != n + 1) {
				ans += 1ll * pos[i] * (R - r) * i;
			}
		}
		else if (r == n + 1) {
			itl--;
			int L = *itl;
			ans += 1ll * (l - L) * (n - pos[i] + 1) * i;
		}
		else {
			itl--; itr++;
			int L = *itl; int R = *itr;
			ans += (1ll * (l - L) * (r - pos[i]) + 1ll * (R - r) * (pos[i] - l)) * i;
		}
		s.insert(pos[i]);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 8272
#include <iostream>
#include <cstdio>
#include <vector>
#include <numeric>

using namespace std;

#define int long long

signed main()
{
    int x;
    vector<int> dp;

    cin >> x;

    dp.resize(x + 1, 0);

    dp[0] = 1;

    for(int i = 0; i <= x; ++i)
    {
        for(int j = 100; j <= 105; ++j)
        {
            if(i - j >= 0 && dp[i - j])
            {
                dp[i] = 1;
            }
        }
    }

    cout << dp[x] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
const int N = 3000300;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =    1e9+7;
int n,m;string s;int id;
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m>>s;
int nxt=-1;
id=n;
vector<int> ans;
while(n)
{
	nxt=-1;
	int x=max(0,n-m);
	rep(i,x,x+m)
	{
		if(s[i]=='0')
		{
			nxt=i;
			n=i;
		//		cout<<i<<endl;
			ans.push_back(i);
			break;
		
		}
	}
	if(nxt==-1)
	{
		cout<<"-1";
		exit(0);
	}
}
reverse(ans.begin(),ans.end());
rep(i,0,ans.size())
{
	if(i==ans.size()-1)
	cout<<id-ans[i]<<endl;
	else
	cout<<ans[i+1]-ans[i]<<" ";
}

}

Measured memory_bytes: 1096
#include <iostream>
#include <algorithm>
#include <string>
#include <climits>
using namespace std;
 
int main() {
    string s, t; cin >> s >> t;
    int ans = INT_MAX;
    for (int i = 0; i < s.size() - t.size(); ++i) {
        int a = 0;
        for (int j = 0; j < t.size(); ++j) {
            a += s[i + j] != t[j];
        }
        ans = min(ans, a);
    }
    if (s.size() == t.size()) {
        ans = 0;
        for (int i = 0; i < s.size(); ++i) {
            ans += s[i] != t[i];
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3596
N=int(input())
A = list(map(int,input().split()))

A_acc=[sum(A)]
for a in A:
    A_acc.append(A_acc[-1]-a)

MOD=10**9+7

ans=0

for i in range(N-1):
    ans+=A_acc[i+1]*A[i]
    ans%=MOD
print(ans)




Measured memory_bytes: 102148
#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int maxn = 1e5+10;
int a[maxn], b[maxn];


int main()
{
    int n, k;
    scanf("%d%d",&n, &k);
    for(int i = 1; i <= n; i++)
        scanf("%d %d",&a[i], &b[i]);
    int now = 0;
    LL ans = 0;
    for(int j = 1; j <= n; j++)
        if((k & a[j])==a[j])
            ans += b[j];
    for(int i = 30; i >= 0; i--){
        LL res = 0;
        if(k & (1 << i)){
            now |= 1 << i;
            now -= 1;
            for(int j = 1; j <= n; j++)
                if((a[j] & now) == a[j])
                    res += b[j];
            now += 1;
            ans = max(ans, res);
        }
    }
    printf("%lld\n", ans );
    return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
long long MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    int x = n * 800;
    int y = static_cast<int>(n/15) * 200;
    cout << x-y << "\n";
    return 0;
}

Measured memory_bytes: 256
a=input().split(' ')
#print(a[0])
b=int(a[0])
d=int(a[1])
c=input().split(' ')
count=0
for i in c:
    count+=int(i)
    
#print(count)
if b-count>=0:
    print(b-count)
else:
    print(-1)

Measured memory_bytes: 9672
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections

N, K = list(map(int, sys.stdin.readline().rstrip().split()))
As = list(map(int, sys.stdin.readline().rstrip().split()))

count = collections.defaultdict(int)

for A in As:
    count[A] += 1

values = list(sorted(count.values()))

print(sum(values[:len(values)-K]))
exit(0)


Measured memory_bytes: 32564
import math
a, b = map(int, input().split())
c = 0

if b < 10:
    c = a*10 + b
elif 10 <= b <= 99:
    c = a*100 + b
elif b == 100:
    c = a*1000 + b

d = math.sqrt(c)

if d.is_integer():
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[102][100009];
struct item{
        ll value, weight;
        item(ll _value, ll _weight)
        {
            value = _value;
            weight = _weight;
        }
};
vector <item> v;

ll knapSack(ll n, ll cap)
{
    if(n==-1 )
        return 0;
    else if(dp[n][cap]==-1)
    {
        if(cap-v[n].weight>=0)
        {
             ll temp2 = v[n].value + knapSack(n-1, (cap - v[n].weight));
             dp[n][cap]= max(temp2, dp[n][cap]);
        }

        ll temp1 = knapSack(n-1, cap);
          dp[n][cap]= max(temp1, dp[n][cap]);

    }
    return dp[n][cap];
}
int main()
{
        ll n, cap,x,y;
        cin>>n>>cap;
        memset(dp, -1, sizeof(dp));
        for(ll i=0; i<n; i++)
        {
            cin>>x>>y;
            v.push_back(item(y,x));
        }
        cout<<knapSack(n-1,cap)<<endl;
}

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

int main(){
	int n,k;scanf("%d%d",&n,&k);
	int ans=0;
	rep(i,n){
		int x;scanf("%d",&x);
		ans+=min(abs(x-0),abs(x-k))*2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=112345;
int n;
char s[maxn];
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    for (int i=1;i+2<=n;++i)
        if (s[i]==s[i+1]||s[i]==s[i+2]||s[i+1]==s[i+2])
            return 0*printf("%d %d\n",i,i+2);
    for (int i=1;i+1<=n;++i)
        if (s[i]==s[i+1])
            return 0*printf("%d %d\n",i,i+1);
    puts("-1 -1");
    return 0;
}


Measured memory_bytes: 3924
#include<stdio.h>
#include<string.h>

int main()
{
    char str[20];
    scanf(" %s",str);
    fflush(stdin);
    if(strcmp(str,"Sunny")==0){
        printf("Cloudy");
    }
    else if(strcmp(str,"Cloudy")==0){
        printf("Rainy");
    }
    else if(strcmp(str,"Rainy")==0){
        printf("Sunny");
    }
}


Measured memory_bytes: 128
//C
#include <cassert>
#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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>
#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>


//Hang in there!

using namespace std;


int main() {
	int N, M;
	N = M = 1;
	while (N != 0 && M != 0) {
		cin >> N >> M;
		if (N == 0 && M == 0) {
			return 0;
		}
		vector<pair<int, int>>data(N);
		for (int i = 0; i < N; i++) {
			cin >> data[i].first >> data[i].second;
		}
		sort(data.begin(), data.end());
		int ans = 0;
		int dif = M;
		for (int i = N - 1; i >= 0; i--) {
			if (data[i].first == dif) {
				ans += data[i].second;
				dif--;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

void fin(){
	freopen("test.txt", "r", stdin);
}

struct state{
	int freeze;
	int total;
	int pos;
	state(int f=0, int t=0, int p=0){
		freeze = f;
		total = t;
		pos = p;
	}
	bool operator<(const state &rhs) const{
		if(total == rhs.total) return freeze < rhs.freeze;
		return total > rhs.total;
	}
};

const int INF = 1<<29;

int main(){
	//fin();
	while(1){
		int n, m, l, k, a, h;
		cin >> n >> m >> l >> k >> a >> h;
		if(!n) break;
		vector<int> hasf(n, 0);
		rep(i, l){
			int f;
			cin >> f;
			hasf[f] = 1;
		}
		vector<vector<int> > edge(n, vector<int>(n, INF));
		rep(i, k){
			int x, y, t;
			cin >> x >> y >> t;
			edge[x][y] = edge[y][x] = t;
		}

		priority_queue<state> q;
		q.push(state(m, 0, a));

		vector<vector<int> > cost(m+1, vector<int>(n, INF));
		vector<int> visit(n, 0);
		while(!q.empty()){
			state s = q.top(); q.pop();

			if( cost[s.freeze][s.pos] <= s.total ) continue;
			cost[s.freeze][s.pos] = s.total;
			if(s.pos == h) break;

			if(!visit[s.pos]){
				if(hasf[s.pos]){
					for(int j = 1; j <= m-s.freeze; j++){
						state next = s;
						next.freeze += j;
						next.total += j;
						q.push(next);
					}
				}
			}
			visit[s.pos] = true;

			rep(i, n){
				if(edge[s.pos][i] == INF) continue;
				state next = s;
				next.freeze -= edge[s.pos][i];
				if(next.freeze < 0) continue;
				next.pos = i;
				next.total += edge[s.pos][i];
				q.push(next);
			}
		}

		int best = INF;
		rep(i, m){
			best = min(best, cost[i][h]);
		}

		if(best == INF) cout << "Help!" << endl;
		else cout << best << endl;
	}

	return 0;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back

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

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i++)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

//library----------------------------------------------

int main() {
    CIN(a,b);
    if(a>b){
        rep(i,a) printf("%d",b);
    }else{
        rep(i,b) printf("%d",a);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
/*input
*/
#include <bits/stdc++.h>
using namespace std;
 
#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define pb push_back
 
using ll = long long;
using pii = pair<int, int>;
 
template<typename T> using V = vector<T>;

int main() {
	ios::sync_with_stdio(false);cin.tie(nullptr);
	int a, b; cin >> a >> b;
	--a;
	int ans = 0, cur = 1;
	while (cur < b) {
		cur += a;
		++ans;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int             long long int
#define pb              push_back
#define se              second
#define mp              make_pair
#define fi              first
#define del(a,vec)      vec.erase(std::remove(vec.begin(), vec.end(), a), vec.end());
#define search(f,l,v)   binary_search(f,l,v)
#define iter(a,b)       vector<int>::iterator a,b
#define lower(v,num)    lower_bound (v.begin(), v.end(), num);
#define upper(v,num)    upper_bound (v.begin(), v.end(), num); 
#define removecopy(a)   unique(a.begin(), a.end()); 
#define vi              vector<int> 
#define pi              pair<int,int>    
#define vpi             vector<pi>      
#define mlbb            ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)    
int mod =1000000007;
namespace Rahul{
    bool isPrime(int n) 
    {if (n <= 1)  return false; if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; }
    int pow (int x, int n,int mod) {//calculate x^n
    if (n == 0) return 1;

    int res = pow (x, n / 2,mod);

    res = (res * res) % mod;
    if (n % 2) res = (res * x ) % mod;

    return res;
    }
    int _gcd(int a,int b)
    {
        if(a==0)
            return b;
        else    
            return _gcd(b%a,a);
    }
    //s.erase(s.find(2)) where s={1,2,3,3,2}; 
};
using namespace Rahul;
int32_t main()
{
        
     mlbb;   
     int a;
     int b;
     cin>>a>>b;
     if(a==1 && b==2)
        cout<<3<<endl;
     if(a==1 && b==3)
        cout<<2<<endl;
     if(a==2 && b==3)
        cout<<1<<endl;    
     if(a==2 && b==1)
        cout<<3<<endl; 
     if(a==3 && b==2)
        cout<<1<<endl;
     if(a==3 && b==1)
        cout<<2<<endl;
     
}


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

int main(){
	char a[101][11];
	int b[101]={0},check=1,i,j,p,q,n;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	for(i=1;i<=n;i++){
		for(j=0;j<=11;j++){
			if(a[i][j]=='\0'){
				b[i]=j-1;
				break;
			}
		}
	}
	for(i=2;i<=n;i++){
		if(a[i-1][b[i-1]]!=a[i][0]){
			cout<<"No";
			return 0;
		}
	}
	for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			if(b[i]!=b[j]) continue;
			int ch=0;
			for(p=0;p<=b[i];p++){
				if(a[i][p]!=a[j][p]){
					ch=1;
					break;
				}
			}
			if(ch==0){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes";
	return 0;
} 

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) {
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]
A = sorted(A)

ans1 = 0
l = 0
r = N-1
for i in range(N-2):
    if i%2 == 0:
        ans1 += 2 * A[r]
        r -= 1
    else:
        ans1 += -2 * A[l]
        l += 1
if N%2 == 0:
    ans1 -= min(A[l], A[r])
    ans1 += max(A[l], A[r])
else:
    ans1 -= (A[l] + A[r])

ans2 = 0
l = 0
r = N-1
for i in range(N-2):
    if i%2 == 1:
        ans2 += 2 * A[r]
        r -= 1
    else:
        ans2 += -2 * A[l]
        l += 1
if N%2 == 0:
    ans2 -= min(A[l], A[r])
    ans2 += max(A[l], A[r])
else:
    ans2 += (A[l] + A[r])

print(max(ans1,ans2))


Measured memory_bytes: 51288
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    s = input().rstrip()

    n = len(s) - 1
    ans = 0
    for i in range(2 ** n):
        tmp = 0
        for j in range(n):
            if (i >> j) & 1:
                ans += int(s[tmp : j + 1])
                tmp = j + 1
        ans += int(s[tmp:])

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int h,w,ans=1e9;
    cin>>h>>w;
    int a[h][w];
    r(i,h)r(j,w)cin>>a[i][j];
    r(i,h)r(j,w){
        int sum=0;
        r(k,h)if(k!=i){
            r(l,w)if(l!=j){
                sum+=min(abs(k-i)*a[k][l],abs(l-j)*a[k][l]);
            }
        }
        ans=min(sum,ans);
    }
    cout<<ans<<endl;
}


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

int main() {
	int ans = 0;
	string S, T;
	cin >> S >> T;
	for(int i = 0; i < 3; i++){
		if(S[i] == T[i]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
r,g,b,n=gets.split.map &:to_i
c=0
(0..n/r).map{|x|
	(0..n/g).map{|y|
		z=(n-r*x-g*y)/b
		c+=1 if z>=0&&r*x+g*y+b*z==n
	}
}
p c

Measured memory_bytes: 79740
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define REP(i, k, n) for(int i=(int)(k); i<(int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 998244353;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	ll X; cin >> X;
	ll now = 100, cnt = 0;
	while(now < X){
		ll p = now/100;
		now += p;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3636
function Main(input) {
  const row = input.split(" ");
    	let X = parseInt(row[0], 10);
    	let K = parseInt(row[1], 10);
    	const D = parseInt(row[2], 10);
    let absX = Math.abs(X);
    let a = Math.floor(absX / D);//往復開始地点までにかかる回数
    let ans;

    if((absX /D) >= K) {
       ans = absX - D * K;

    } else {
    let K2 = K - a;
       absX = absX % D;//余りが0に最も近い座標
       if(K2 % 2 === 0) {
    　ans = absX;
      } else {
         ans = absX - D;
      }
    } console.log(Math.abs(ans));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30336
n = int(input())
a = list(map(int,input().split()))

judge = True
ans = 0

if 0 not in a:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            judge = False
            break
        
if judge:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 21476