akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

int main() {
    ll t,k,y;
    cin>>t>>k>>y;
    bool a = (t==k)&&(k==y);
    if(a) pr("Yes");
    else pr("No");
    return 0;
}



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

#define LL long long

#define FOR(INDEX, START, END) for (int INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (int INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N, M;
	cin >> N >> M;
	vector<LL> Xs(M);
	REP(i, M) {
		cin >> Xs[i];
	}

	std::sort(Xs.begin(), Xs.end());

	vector<LL> ds(M - 1);
	REP(i, M - 1) {
		ds[i] = Xs[i + 1] - Xs[i];
	}
	
	std::sort(ds.begin(), ds.end(), greater<LL>());
	
	LL sum = 0;
	for (LL i = N - 1; i < ds.size(); ++i) {
		sum += ds[i];
	}

	cout << sum << endl;


	return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int a[N],b[N];
  a[0]=0;
  b[N-1]=0;
  for(int i=0;i<N-1;i++){
    if(S[i]=='W')a[i+1]=a[i]+1;
    else a[i+1]=a[i];
    if(S[N-i-1]=='E')b[N-i-2]=b[N-i-1]+1;
    else b[N-i-2]=b[N-i-1];
  }
  int min=10000000;
  for(int i=0;i<N;i++){
    int x=a[i]+b[i];
    if(x<min){
      min=x;
    }
  }
  cout << min;
}

Measured memory_bytes: 2948
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    c=input()
    ordc=ord(c)
    print(chr(ordc+1))
main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

template<typename T> // INFに注意
class SegTree {
private:
  int n;
  vector<T> data;
  T _query(int a, int b, int k, int l, int r){
    if(r<=a || b<=l) return INF;
    if(a<=l && r<=b) return data[k];
    T vl=_query(a,b,k*2+1,l,(l+r)/2);
    T vr=_query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
public:
  SegTree(int n_){
    n=1;
    while(n<n_) n*=2;
    data.resize(2*n-1);
    fill(all(data), INF);
  }
  void update(int k, T a){ // update data[k]=a, k(0-indexed)
    k+=n-1;
    data[k]=a;
    while(k>0){
      k = (k-1)/2;
      data[k] = min(data[k*2+1], data[k*2+2]);
    }
  }
  inline T query(int a, int b){ return _query(a,b,0,0,n);} //min value in [a,b)
  inline T operator[](int idx){ return data[idx+n-1]; }
}; // END class SegTree


int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  rep(i,n) cin>>vec[i], vec[i]--;
  vector<int> pos(n);
  rep(i,n) pos[vec[i]] = i;
// dbg(vec);
  SegTree<int> even(n+1), odd(n+1);
  rep(i,n){
    if(i%2) odd.update(i, vec[i]);
    else even.update(i, vec[i]);
  }

  vector<int> ans;

  using P = pair<int,int>;
  priority_queue<pair<int,P>, vector<pair<int,P>>, greater<pair<int,P>>> pq;
  pq.push(mp(even.query(0,n),mp(0,n)));

  while(!pq.empty()){
    auto p = pq.top(); pq.pop();
    int l = p.se.fi, r = p.se.se;//dbg(l,r);
    int p1 = pos[p.fi];
    int p2;
    bool sw = false;
    if(p1%2==0){
      if((p1-l)%2==0) p2 = odd.query(p1, r);
      else sw=true,p2 = odd.query(l, p1);
      assert(p2!=INF);
      p2 = pos[p2];
      odd.update(p2, INF);
      even.update(p1, INF);
    }
    else {
      if((p1-l)%2==0) p2 = even.query(p1, r);
      else sw=true, p2 = even.query(l, p1);
      assert(p2!=INF);
      p2 = pos[p2];
      even.update(p2, INF);
      odd.update(p1, INF);
    }
    if(sw) swap(p1,p2);
    ans.pb(vec[p1]);ans.pb(vec[p2]);

    auto ins = [&](int a, int b){
      if(a==b) return;
      int x;
      if(a%2==0) x = even.query(a,b);
      else x = odd.query(a,b);
      pq.push(mp(x, mp(a,b)));
    };
//    dbg(p1,p2);
    ins(l,p1);
    ins(p1+1,p2);
    ins(p2+1,r);
  }

  rep(i,n) cout << ans[i]+1 << " \n"[i==n-1];

  return 0;
}


Measured memory_bytes: 8616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define pb push_back
#define pf push_front
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
#define vc4d(nam,type,a,b,c,d,fix) vector<vector<vector<vector<type>>>> nam(a,vector<vector<vector<type>>>(b,vector<vector<type>>(c,vector<type>(d,fix))))
const ll oo=(1ll<<60);
int gg(){
    int x=0,w=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')w=0,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return w?x:-x;
}
ll h,w,ch,cw,dh,dw;
ll X[]={-1,1,0,0},Y[]={0,0,1,-1},xxx[]={-1,-1,1,1,-2,-2,-2,-2,-2,-1,-1,0,0,1,1,2,2,2,2,2},yyy[]={1,-1,-1,1,-2,-1,0,1,2,-2,2,-2,2,-2,2,-2,-1,0,1,2};
bool safe(ll x,ll y)
{
    if(x>-1 and y>-1 and x<h and y<w)return true;
    return false;
}
int main()
{
     io;
    int T=1;
    //T=gg();
    //cin>>T;
    //for(int cas=1;cas<=T;cas++)
    while(T--)
    {
        ll i,j,k,l,cnt=0;
        cin>>h>>w>>ch>>cw>>dh>>dw;
        vector<string> v(h);
        for(auto &x:v)cin>>x;
        ch--,cw--,dh--,dw--;
        queue<pl> qq({{ch,cw}}),pp;v[ch][cw]='#';
        while(1)
        {
            if(!qq.empty())
            {
                while(!qq.empty())
                {
                    pl u=qq.front();
                    if(u.ff==dh and u.ss==dw)
                    {
                        cout<<cnt;
                        return 0;
                    }
                    pp.push(u);
                    qq.pop();
                    for(i=0;i<4;i++)
                    {
                        ll x=u.ff+X[i],y=u.ss+Y[i];
                        if(safe(x,y) and v[x][y]=='.')
                        {
                            v[x][y]='#';
                            qq.push({x,y});
                        }

                    }
                }
            }
            else if(!pp.empty())
            {
                while(!pp.empty())
                {
                    pl u=pp.front();
                    pp.pop();
                    for(i=0;i<20;i++)
                    {
                        ll x=u.ff+xxx[i],y=u.ss+yyy[i];
                        if(safe(x,y) and v[x][y]=='.')
                        {
                            v[x][y]='#';
                            qq.push({x,y});
                        }
                    }

                }
                cnt++;
            }
            else
            {
                cout<<-1;
                return 0;
            }
        }


    }
    return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std; using namespace placeholders;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector< int > VI;
typedef vector< vector< int > > VVI;
typedef vector< string > VS;
typedef stringstream SS;
typedef pair< int, int > PII;
typedef vector< pair< int, int > > VPII;
#define VT( T ) vector< T >
#define VVT( T ) vector< vector< T > >
#define LIM( T ) numeric_limits< T >

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &e : c )
#define ALL( c ) ( c ).begin(), ( c ).end()
#define AALL( a, t ) ( t* )a, ( t* )a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) ( c ).begin(), ( c ).begin() + p, ( c ).end()

#define SZ( v ) ( (int)( v ).size() )
#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

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

	int N, M;
	cin >> N >> M;

	VI as( M ), ls( M );
	REP( i, M )
	{
		cin >> as[i] >> ls[i];
	}

	VI color( N );
	REP( i, M )
	{
		REP( j, ls[i] )
		{
			color[ ( as[i] + j ) % N ] = 1;
		}
	}

	int pos = find( ALL( color ), 0 ) - color.begin();
	if ( pos != N )
	{
		rotate( DRANGE( color, pos ) );
	}

	map< int, int > res;
	REP( i, N )
	{
		if ( !color[i] )
		{
			continue;
		}

		int j = i;
		for ( ; j < N && color[j]; ++j );

		++res[ i - j ];

		i = j - 1;
	}

	FOR( p, res )
	{
		cout << -p.fst << ' ' << p.snd << endl;
	}

	return 0;
}


Measured memory_bytes: 1212
n=int(input())
a,c,i=[],0,1
while i <= n:
    if c==0:
        x=i
        if x%3==0:
            print(' '+str(i), end='')
            i+=1
            continue
    c=0
    if x%10==3:
        print(' '+str(i), end='')
        i+=1
        continue
    x//=10
    if x == 0:
        i+=1
        continue
    else:
        c=1
print()

Measured memory_bytes: 7884
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{
			string ab = Console.ReadLine();
			string[] num = ab.Split(' ');
			int a = int.Parse(num[0]);
			int b = int.Parse(num[1]);

			if (a < b)
			{
				Console.WriteLine("a < b");
			}
			else if (a > b)
			{
				Console.WriteLine("a > b");
			}
			else
				Console.WriteLine("a == b");

		}
	}
}



Measured memory_bytes: 15940
#include<iostream>
using namespace std;
int main()
{
	string str1;
    string str2;
	cin >> str1 >> str2;
    int len = str1.length();
  	int comp = str2.compare(0,len,str1);
  if(comp == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<uint> vuint;
typedef vector<ull> vull;
typedef vector<ll> vll;

#define init(type,var) type var;cin>>var;
#define vinit(type,var,n) vector<type> var((uint)n);loop(i,0,n)cin>>var[i];
#define range(container) container.begin(),container.end()
#define loop(i,first,end) for(ull i=(first);i<(end);i++)
#define outl(out) cout<<(out)<<endl;

const ull INF = (ull)(-1LL);

typedef ll dint;

int main(void){
	init(dint, n);
	init(dint, k);
	init(dint, q);

	vector<dint> p(n, 0);

	loop(i, 0, q){
		uint a;
		cin >> a;
		p[a - 1]++;
	}

	loop(i, 0, n){
		outl((k - q + p[i] > 0) ? "Yes" : "No");
	}

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

long long int const LL_MAX = 10000000000000000; // 10^16
int const INT_MAX = 100000000; // 10^8

int DP_sum[21][100001];
int doll_sum[21];
int DP[2000000];
int Sum[2000000];

int main(){
	
	int N, M;
	
	cin >> N >> M;
	
	for(int i = 0; i <= M; i++){
		DP_sum[i][0] = 0;
	}
	
	for(int i = 1; i <= N; i++){
		int num;
		cin >> num;
		for(int j = 1; j <= M; j++){
			DP_sum[j][i] = DP_sum[j][i - 1];
		}
		DP_sum[num][i]++;
	}
	
	for(int i = 0; i <= M; i++){
		doll_sum[i] = DP_sum[i][N];
	}
	
	for(int i = 0; i < 2000000; i++){
		DP[i] = INT_MAX;
	}
	
	Sum[0] = 0;
	DP[0] = 0;
	
	for(int i = 0; i < (1 << M); i++){
		int hoge = i;
		int comp = 1;
		for(int j = 1; j <= M; j++){
			if(hoge % 2 == 1){
				Sum[i] = Sum[i - comp] + doll_sum[j];
				DP[i] = min(DP[i], DP[i - comp] + doll_sum[j] - (DP_sum[j][Sum[i]] - DP_sum[j][Sum[i - comp]]));
			}
			hoge /= 2;
			comp *= 2;
		}
	}
	
	cout << DP[(1 << M) - 1] << endl;
	
	return 0;
}

Measured memory_bytes: 22808
import java.io.*;
import java.util.*;
public class Main implements Runnable{
    
    private void solve()throws IOException{
        String s=nextLine();
        for(int i=0;i<s.length();i++)
            out.print('x');
    }

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

    final long mod=(long)(1e9+7);
    final int inf=(int)(1e9+1);
    final int maxn=(int)(1e6);
    final long lim=(long)(1e18);

    public void run(){
        try{
            br=new BufferedReader(new InputStreamReader(System.in));
            st=null;
            out=new PrintWriter(System.out);

            solve();

            // int t=nextInt();
            // for(int i=1;i<=t;i++){
            //     // out.print("Case #"+i+": ");
            //     solve();
            // }

            br.close();
            out.close();
        }catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
    }
    public static void main(String args[])throws IOException{
        new Main().run();
    } 
    int max(int ... a){
        int ret=a[0];
        for(int i=1;i<a.length;i++)
        ret=Math.max(ret,a[i]);
        return ret;
    }
    int min(int ... a){
        int ret=a[0];
        for(int i=1;i<a.length;i++)
        ret=Math.min(ret,a[i]);
        return ret;
    }
    void debug(Object ... a){
        System.out.print("> ");
        for(int i=0;i<a.length;i++)
        System.out.print(a[i]+" ");
        System.out.println();
    }
    void debug(int a[]){debuga(Arrays.stream(a).boxed().toArray());}
    void debug(long a[]){debuga(Arrays.stream(a).boxed().toArray());}
    void debuga(Object a[]){
        System.out.print("> ");
        for(int i=0;i<a.length;i++)
        System.out.print(a[i]+" ");
        System.out.println();
    }
    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    String nextToken()throws IOException{
        while(st==null || !st.hasMoreTokens())
        st=new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    String nextLine()throws IOException{
        return br.readLine();
    }
    int nextInt()throws IOException{
        return Integer.parseInt(nextToken());
    }
    long nextLong()throws IOException{
        return Long.parseLong(nextToken());
    }
    double nextDouble()throws IOException{
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 22740
package main

import (
  "fmt"
  "strings"
)

func main() {
  var s string
  fmt.Scan(&s)
  enable := true
  for len(s)>0 {
	if strings.HasSuffix(s,"dream") {
	  s = s[:len(s)-len("dream")]
	} else if strings.HasSuffix(s,"dreamer") {
	  s = s[:len(s)-len("dreamer")]
	} else if strings.HasSuffix(s,"erase") {
	  s = s[:len(s)-len("erase")]
	} else if strings.HasSuffix(s,"eraser") {
	  s = s[:len(s)-len("eraser")]
	} else {
	  enable = false
	  break
	}
  }
  if enable {
	fmt.Println("YES")
  } else {
	fmt.Println("NO")
  }
}


Measured memory_bytes: 1280
import sys
import math

for line in sys.stdin:
    e = int(line)
    if e == 0:
        break

    a = str(math.factorial(e))
    cnt = 0
    for i in range(len(a)):
        if a[-(i+1)] == str(0):
            cnt += 1
        else:
            break
    print(cnt)

Measured memory_bytes: 6968
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

int dp[3100][3100];

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


    for(int i=1;i<=(int)s.size();i++){
        for(int j=1;j<=(int)t.size();j++){
            if(s[i-1]==t[j-1]){
                chmax(dp[i][j],dp[i-1][j-1]+1);
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int ns=(int)s.size(),nt=(int)t.size();
    int n=dp[ns][nt];

    vector<char> ans;
    int  nows=ns,nowt=nt,now=n;
    while(now!=0){
        //cout<<nows<<" "<<nowt<<endl;
        if(s[nows-1]==t[nowt-1]){
            ans.push_back(s[nows-1]);
            nows--; nowt--;
            now--;
        }else if(now==dp[nows][nowt-1]){
            nowt--;
        }else{
            nows--;
        }
    }
    reverse(ans.begin(),ans.end());
    for(int i=0;i<(int)ans.size();i++){
        cout<<ans[i];
    }
    cout<<endl;
}


Measured memory_bytes: 37120
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                     \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
typedef long long ll;
/**
 * Uncomment the #define below if problem contains multiple test cases
 */
// #define MULTIPLE_TESTS 1

void solve() {
  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= 100; ++i) {
    for (int j = 0; j <= 100; ++j) {
      if (2 * i + 4 * j == y && i + j == x) {
        cout << "Yes" << endl;
        return;
      }
    }
  }
  cout << "No" << endl;
}

int main() {
  FAST_IO;
  int t = 1;
#ifdef MULTIPLE_TESTS
  cin >> t;
#endif

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

  return 0;
}

Measured memory_bytes: 3636
//
//AtCoder Beginner Contest 124
//C
//https://atcoder.jp/contests/abc124/tasks/abc124_c
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    int ans=0;
    char prv=s[0];
    REP(i,s.size()){
        if (i==0) continue;
        if (prv==s[i]) ans++;
        prv = (prv=='0' ? '1' : '0');
    }
    cout << ans << endl;
    return 0;
}


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

const int maxn = 200010;
int p[maxn], pos[maxn];

int main()
{
	//freopen("B.in","r",stdin);
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&p[i]), pos[p[i]] = i;
	int ans = 0, k = 0;
	for (int i=1;i<=n+1;i++)
	{
		if (pos[i] > pos[i-1]) k++;
		else
		{
			ans = max(ans,k);
			k = 1;
		}
	}
	printf("%d\n",n - ans);
	return 0;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Seven Puzzle
 */
public class Main {

	static int SIZE = 8;
	static final int[][] SWAP = {
			{1, 4},     //0
			{0, 2, 5},  //1
			{1, 3, 6},  //2
			{2, 7},     //3
			{0, 5},     //4
			{1, 4, 6},  //5
			{2, 5, 7},  //6
			{3, 6},     //7
	};

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		Map<Integer, Integer> moves = new HashMap<>();
		Deque<int[][]> que = new ArrayDeque<>();
		int[] puzzle = {0, 1, 2, 3, 4, 5, 6, 7};

		que.offer(new int[][]{puzzle, {0}, {0}});
		moves.put(a2i(puzzle), 0);

		while (!que.isEmpty()) {
			int[][] s = que.poll();
			for (int i = 0; i < SWAP[s[1][0]].length; i++) {
				int[] t = new int[SIZE];
				System.arraycopy(s[0], 0, t, 0, SIZE);
				//swap
				t[s[1][0]] = t[SWAP[s[1][0]][i]];
				t[SWAP[s[1][0]][i]] = 0;
				if (!moves.containsKey(a2i(t))) {
					que.offer(new int[][]{t, {SWAP[s[1][0]][i]}, {s[2][0] + 1}});
					moves.put(a2i(t), s[2][0] + 1);
				}
			}
		}

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			System.out.println(moves.get(s2i(line)));
		}
	}

	static int a2i(int[] a) {
		int ret = 0;
		for (int i = 0; i < SIZE; i++) {
			ret *= 10;
			ret += a[i];
		}
		return ret;
	}

	static int s2i(String s) {
		int ret = 0;
		for (int i = 0; i < s.length(); i += 2) {
			ret *= 10;
			ret += s.charAt(i) - '0';
		}
		return ret;
	}
}

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

int main() {
    int n,a;
    cin >> n;
    bool ans=1;
    rep(i,n) {
        cin >> a;
        if (a%2==0) {
            if (a%3!=0 && a%5!=0) ans=0;
        }
    }
    if(ans) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int N;
  int K;
  int h[100000];
  int S;
  int i;
  
  cin >> N;
  cin >> K;
  for(i=0;i<N;i++){
    cin >> h[i];
  }
  for(i=0;i<N;i++){
    if(h[i]>=K){
      S+=1;
    }
  }
  cout << S;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    
    private static final long MOD = 1_000_000_007;
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        final int S = sc.nextInt();
        
        final long[] nums = new long[Math.max(S + 1, 6)];
        
        nums[0] = 0;
        nums[1] = 0;
        nums[2] = 0;
        nums[3] = 1;
        nums[4] = 1;
        nums[5] = 1;
        
        for (int i = 6; i <= S; i++) {
            nums[i] = nums[i - 3] + nums[i - 1];
            nums[i] %= MOD;
        }
        
        System.out.println(nums[S]);
    }
}


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

int main() {
    char S[20];
    cin >> S;

    int l = 0;
    int maxl = 0;
    int L = strlen(S);
    for (int i = 0; i < L; i++) {
        if (S[i] == 'A' | S[i] == 'T' | S[i] == 'G' | S[i] == 'C') {
            l++;
        } else {
            l = 0;
        }
        if (maxl < l) maxl = l;
    }

    cout << maxl << endl;
    return 0;
}

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

int main() {
  int x,y;
  cin >> x >> y;

  if (y-2*x>=0 && 4*x-y>=0 && (y-2*x)%2==0 && (4*x-y)%2==0) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}  




Measured memory_bytes: 3632
#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[i];
    }

    int count = 0;
    bool allEven = true;

    while(allEven) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) {
                a[i] /= 2;
            } else {
                allEven = false;
                break;
            }
        }
        if (allEven) count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{

    public class Program
    {
        static void Main(string[] args)
        {
            var nkq = Console.ReadLine().Split(' ');
            var n = int.Parse(nkq[0]);
            var k = int.Parse(nkq[1]);
            var q = int.Parse(nkq[2]);
            int[] points = new int[n];
            for(int i = 0;i < q; i++)
            {
                var idx = int.Parse(Console.ReadLine()) - 1;
                points[idx]++;
            }
            foreach(var tmp in points.Select(x => x - q + k))
            {
                Console.WriteLine(tmp > 0 ? "Yes" : "No");
            }
        }
    }
}


Measured memory_bytes: 15836
#include <cstdio>
using  namespace std;
int  main() {
  int a,b,jum=0;
  scanf("%d %d", &a, &b);
  for(int i=1; i<=2; i++){
   if (a>b) {
    jum=jum+a;
    a--;
   } else if (b>a) {
    jum=jum+b;
    b--;
   } else {
    jum=jum+a;
   }
  }
  printf("%d\n", jum);
}

Measured memory_bytes: 128
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)
from pprint import pprint


'''
25
'''

def solve(x):
	d = {}
	for i in range(1,10):
		for j in range(1,10):
			s = str(i) + str(j)
			d[s] = 0

	rr = {}
	for i in d:
		rr[i] = i[::-1]
		rr[i[::-1]] = i

	ans = 0
	for i in range(1,x+1):
		ii = str(i)
		if(ii[-1] != '0'):
			s = ii[0] + ii[-1]
			r = rr[s]
			d[s] += 1
	for i in d:
		ans += d[i]*d[rr[i]]
	return ans

N = int(stdin.readline())
ans = solve(N)
print(ans)


Measured memory_bytes: 4976
#include<iostream>
using namespace std;
int main(){
  int N ,q = 0,sum = 0 ,p;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p;
    if(q < p) {
      q = p;
      sum += p;
    } else {
      sum += p;
    }
  }
  sum = sum - (q / 2);
  cout << sum << endl;
  return 0;
}

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

int main() {
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int time = (h2*60 + m2) - (h1*60 + m1);
	int ans = time - k;
	cout << ((ans > 0) ? ans : 0) << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int main()
{
    ll n, m;
    cin >> n >> m;
    ll arr[300005] = {};
    ll sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
    }
    sort(arr, arr+n, greater<ll>());
    for(int i = 0; i < m; i++)
    {
        sum -= arr[i];
    }
    if(sum <= 0)
    {
        cout << "0" << endl;
    }
    else
    {
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 2560
#!/usr/bin/env python3

def main():
    n, a, b = map(int, input().split())
    xn = list(map(int, input().split()))

    res = 0
    for i in range(1, n):
        res += min(b, (xn[i] - xn[i - 1]) * a)
    print(res)

main()


Measured memory_bytes: 14252
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

struct Edge{
	Edge(int arg_to,ll arg_dist){
		to = arg_to;
		dist = arg_dist;
	}
	int to;
	ll dist;
};

ll ans;
int V;
vector<Edge> G[SIZE];


ll recursive(int node_id,int parent){

	ll max_path1 = 0;
	ll max_path2 = 0;

	for(int i = 0; i < G[node_id].size(); i++){

		int child = G[node_id][i].to;
		if(child == parent)continue;

		ll tmp_dist = G[node_id][i].dist+recursive(child,node_id);

		if(tmp_dist > max_path1){

			max_path2 = max_path1;
			max_path1 = tmp_dist;

		}else if(tmp_dist > max_path2){

			max_path2 = tmp_dist;
		}
	}
	ans = max(ans,max_path1+max_path2);

	return max_path1;
}


int main(){

	scanf("%d",&V);

	int from,to;
	ll dist;

	for(int loop = 0; loop < V-1; loop++){

		scanf("%d %d %lld",&from,&to,&dist);
		G[from].push_back(Edge(to,dist));
		G[to].push_back(Edge(from,dist));
	}

	ans = 0;
	recursive(0,-1);

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

	return 0;
}



Measured memory_bytes: 18048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test02
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().ToCharArray();

            int r = 0;
            for (int i = 0; i < N; i++)
            {
                if (s[i] == 'R') { r++; }
            }

            if(r > (N - r))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 11092
n = int(input())
ls = list(map(int, input().split()))
k = 1
lo = 0
ans = 0
for x in range(n):
    if ls[x] == k and k == 1:
        lo = x
        ans = x
        k += 1
      
    elif ls[x] == k:
        ans += x-1 - lo
        lo = x
        k += 1
      
    else:
        pass
if k == 1:
    print(-1)
else:
    print(ans+((n-1)-lo))

Measured memory_bytes: 25716
while True:
    m,r,f=map(int,input().split())
    if m+r+f==-3:
        break
    else:
        if m==-1 or r==-1:
            print("F")
        elif m+r>=80:
            print("A")
        elif 65<=m+r<80:
            print("B")
        elif 50<=m+r<65:
            print("C")
        elif 30<=m+r<50:
            if f>=50:
                print("C")
            else:
                print("D")
        else:
            print("F")


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

typedef pair<int,pii> ppii;
int h,w;
char s[51][51];
queue<ppii> qu;

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

int sum = 0;

int main(){
  cin >> h>>w;
  REP(i,h){
    scanf("%s",s[i]);
  }
  REP(i,h)REP(j,w){
    if(s[i][j] == '#') sum++;
  }
  s[0][0]='#';
  qu.push(ppii(1,pii(0,0)));
  while(!qu.empty()){
    ppii front = qu.front();
    qu.pop();
    int x = front.second.first;
    int y = front.second.second;
    int cnt = front.first;
    if(x==w-1&&y==h-1){
      cout << h*w-sum-cnt<<endl;
      return 0;
    }
    REP(i,4){
      int nx = x+dx[i];
      int ny = y+dy[i];
      if(nx >=w || ny >= h ||  nx < 0 || ny < 0) continue;
      if(s[ny][nx] == '#') continue;
      s[ny][nx] = '#';
      qu.push(ppii(cnt+1,pii(nx,ny)));
    }
  }
  cout << -1 <<endl;

}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    vector<ll> s(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
        s[i] += s[i - 1];
    }

    vector<ll> v;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < i; j++) {
            v.push_back(s[i] - s[j]);
        }
    }

    ll ans = 0;
    for (int i = 39; i >= 0; i--) {
        ll nex = ans + (1LL << i);
        
        int cnt = 0;
        for (ll x : v) {
            ll hoge = (x & nex);
            if (hoge == nex) cnt++;
        }

        if (cnt >= K) ans = nex;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5872
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");

        final int N = Integer.parseInt(sc.next());
        SortedMap<Integer, Integer> map = new TreeMap<>();
        for (Integer i = 1; i <= N; i++) {
            map.put(Integer.parseInt(sc.next()), i);
        }
        Set<Map.Entry<Integer, Integer>> sets = map.entrySet();
        sets.forEach(set -> out.print(set.getValue() + " "));
        out.println();
        
        out.flush();
    }
}

Measured memory_bytes: 63688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

int main() {
    int n, m;
    cin >> n >> m;
    ll s[n], t[m];

    rep(i, n) { cin >> s[i]; }
    rep(j, m) { cin >> t[j]; }

    ll dp[n + 1][m + 1];

    rep(i, n + 1) { dp[i][0] = 1; }
    rep(i, m + 1) { dp[0][i] = 1; }

    repd(i, 1, n + 1) {
        repd(j, 1, m + 1) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
            } else {
                dp[i][j] =
                    (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1] + mod) %
                    mod;
            }
        }
    }
    cout << dp[n][m] << endl;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int a, b, v, w, t;
	cin >> a >> v >> b >> w >> t;
	if(v <= w){
		cout << "NO" << endl;
		return 0;
	}
	if(a > b){
		if((a - b) <= ((v - w) * t)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}else{
		if((b - a) <= ((v - w) * t)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

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

int main(){
  int n;
  string str;
  cin>>str;

  int flg=0;
  int ans=0;
  for(int i=0;i<str.size();i++){
    if(str[i]=='C')flg=1;
    if(flg==1&&str[i]=='F')flg=2,ans=1;
  }    
  
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        mut a: i32,
        mut b: i32,
        mut c: i32,
    }

    let mut count = 0;

    let result = loop {
        if a % 2 == 0 && b % 2 == 0 && c % 2 == 0 {
            if a == b && b == c { break -1 };
            let tma = b / 2 + c / 2;
            let tmb = c / 2 + a / 2;
            let tmc = a / 2 + b / 2;
            a = tma; b = tmb; c = tmc;
            count += 1;
        } else {
            break count;
        }
    };

    println!("{}", result);

}


Measured memory_bytes: 2144
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

ll dp[41][1<<16][2];

int main(int argc, char* argv[])
{
    int n,x,y,z;
    scanf("%d%d%d%d", &n, &x, &y, &z);

    int s=(1<<(x+y+z))+(1<<(y+z))+(1<<z);
    int s2=s/2;

    dp[0][0][0]=1;
    int i,j,p,k;
    for(i=0; i<n; i++) {
        for(j=0; j<(1<<16); j++) {
            for(p=0; p<2; p++) {
                if(dp[i][j][p]) {
                    for(k=1; k<=10; k++) {
                        ll tmp=((ll)((j<<1)+1)<<(k-1));
                        int flag=p;
                        if(flag==0 && (tmp&s2)==s2) {
                            flag=1;
                        }
                        int j2=tmp%(1<<16);
                        dp[i+1][j2][flag]=(dp[i+1][j2][flag]+dp[i][j][p])%MOD;              
                    }
                }
            }
        }
    }
    ll ans=0;
    for(j=0; j<(1<<16); j++) {
        ans=(ans+dp[n][j][1])%MOD;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 40064
#include <stdio.h>
int main(){
    long long int K,A,B;
    scanf("%lld %lld %lld",&K,&A,&B);
    long long int ans;
    if(B<=A+2){
        ans=K+1;
    }else{
        ans=A+(B-A)*((K-A+1)/2)+(K-A+1)%2;
    }
    printf("%lld",ans);
}

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

int main(){
    
	int input;
	int ACc = 0;
	int WAc = 0;
	int TLEc = 0;
	int REc = 0;
	char inputted[100];
	
	scanf("%d", &input);
	for(int i = 1; i <= input; i++){
		scanf("%s", inputted);
		if('A' == inputted[0])
		{
			ACc++;
		}
		else if('W' == inputted[0])

		{
			WAc++;
		}
		else if('T' == inputted[0])
		{
			TLEc++;
		}
		else if('R' == inputted[0])
		{
			REc++;
		}
	}
	
	printf("AC x %d\n", ACc);
	printf("WA x %d\n", WAc);
	printf("TLE x %d\n", TLEc);
	printf("RE x %d\n", REc);
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  
  ll x=n/(a+b);
  ll ans=x*a;
  if(n%(a+b)>=a)ans+=a;
  else ans+=n%(a+b);
  cout<<ans<<endl;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        out.println(n/3);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 22740
#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 ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

int main() {
    // source
    int a, b;
    cin >> a >> b;
    bool ans[3] = {true, true, true};

    ans[a - 1] = false;
    ans[b - 1] = false;

    rep(i, 3) {
        if (ans[i]) {
            cout << i + 1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

l = []
for i, ai in enumerate(a, 1):
    l += [i] * ai

for i in range(h):
    ansi = l[w * i:w * (i + 1)]
    print(*(ansi if i % 2 == 0 else ansi[::-1]))


Measured memory_bytes: 74256
# -*- coding: utf-8 -*-

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

ans = 0
for i in range(len(p)-2):
    p1 = p[i]
    p2 = p[i+1]
    p3 = p[i+2]
    if p1 < p2 and p2 < p3:
        ans += 1
    elif p3 < p2 and p2 < p1:
        ans += 1

print(ans)

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

using namespace std;

int main()
{
    int K, A, B;
    cin >> K >> A >> B;

    for (int i = A; i <= B; i++)
    {
        if (i % K == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;


ll dp[110][110];
bool flag[110][110];
int n;
vector<ll>p;

ll rec(ll left,ll right){
    if(flag[left][right])return dp[left][right];
    if(left == right){
        flag[left][right]=true;
        return dp[left][right]=0;
    }
    if(left>right){
        return 0;
    }
    if(right -left ==1){
        flag[left][right]=true;
        return dp[left][right] = p[left]*p[left+1]*p[left+2];
    }
    ll Min = INF;
    for(ll l=left;l<right;l++){
        Min =min(Min,rec(left,l)+rec(l+1,right)+p[left]*p[l+1]*p[right+1]);
    }
    flag[left][right]=true;
    return dp[left][right]=Min;
}

int main(void){
    cin>>n;
    vector<int>r(n),c(n);
    for(int i=0;i<n;i++)cin>>r[i]>>c[i];
    p.resize(n+2);
    p[1]=r[0];
    for(int i=2;i<=n+1;i++)p[i]=(c[i-2]);
    //dp[l][r]をl,l+1,...,r-1と定める
    cout<<rec(1,n)<<endl;
    
    return 0;
}


Measured memory_bytes: 3124
unittest
{
	assert( [ "3 6", "3 4 5" ].parse.expand.solve == 2 );
	assert( [ "4 9", "3 3 3 3" ].parse.expand.solve == 4 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nx = input.front.split.to!( long[] );
	input.popFront;
	auto ls = input.front.split.to!( long[] );
	return tuple( nx[ 1 ], ls );
}

auto solve( long x, long[] ls )
{
	auto ans = 1L;
	auto d = 0L;
	foreach( l; ls )
	{
		d = d + l;
		if( x < d ) break;
		ans++;
	}
	return ans;
}


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

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

    int n, k, l;
    cin >> n >> k;

    vector<int> lengths;

    for(int i = 0; i < n; i++){
        cin >> l;
        lengths.push_back(l);
    }

    sort(lengths.begin(), lengths.end(), greater<int>());

    int total = 0;

    for(int i = 0; i < k; i++){
        total = total + lengths[i];
    }

    cout << total;
}

Measured memory_bytes: 256
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v)                      \
    for (auto __macro_vi : v)      \
    {                              \
        cout << __macro_vi << " "; \
    }                              \
    cout << endl;
#define DA(a, n)                                        \
    for (int __macro_i = 0; __macro_i < n; ++__macro_i) \
    {                                                   \
        cout << a[__macro_i] << " ";                    \
    }                                                   \
    cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
template <class T, class U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int v[3];
    REP(i, 3)
    cin >> v[i];
    int ans = 100000;
    REP(tv, 60)
    {
        if (tv < *max_element(v, v + 3))
            continue;
        int diff = 0;
        REP(i, 3)
        {
            diff += tv - v[i];
        }
        if (diff % 2 != 0)
            continue;
        ans = min(ans, diff / 2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 632
import java.util.Scanner;
 
public class Main {
	
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
		int A2 = sc.nextInt();
		int A3 = sc.nextInt();
		System.out.println(A1+A2+A3>21 ? "bust":"win");
	}	
}

Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char ch[210000];
char st[210000];
char s[210000];
ll ans,top;

void solve()
{

    int top1=0;
    if(top<3)   return;
    while((top>=3&&ch[top-3]=='A'&&ch[top-2]=='B'&&ch[top-1]=='C')||top1){
        if(top>=3&&ch[top-3]=='A'&&ch[top-2]=='B'&&ch[top-1]=='C'){
            ans++;  top-=3;
            st[top1++]='A';st[top1++]='C';st[top1++]='B';
        }
        else{
            ch[top++]=st[top1-1]; top1--;
        }
    }
    return ;
}

int main()
{
    int t=0;
    scanf("%s",s);
    int l=strlen(s);
    for(int i=0;i<l-1;i++){
        if(s[i]=='A')   t++;
        else{
            if(s[i]=='B'&&s[i+1]=='C')  ans+=t,i++;
            else t=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    int M, K;
    cin >> M >> K;
    if (M == 0) {
        if (K == 0) cout << "0\n0\n";
        else cout << "-1\n";
    } else if (M == 1) {
        if (K == 0) cout << "0\n0\n1\n1\n";
        else cout << "-1\n";
    } else {
        if (K >= (1 << M)) {
            cout << "-1\n";
        } else {
            cout << K << "\n";
            rep(i, 1 << M) {
                if (i != K) cout << i << "\n";
            }
            cout << K << "\n";
            for (int i = (1 << M) - 1; i >= 0; --i) {
                if (i != K) cout << i << "\n";
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;


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

  std::vector<int> l(N);
  std::copy_n(std::istream_iterator<int>{std::cin}, l.size(), l.begin());
  
  sort(l.begin(),l.end());
  
  int sum=0;
  for(int i=N-K;i<N;i++){
	sum+=l[i];
  }
  cout << sum << endl;

}

Measured memory_bytes: 256