akhauriyash/Code-Regression huggingface dataset:
main()
{
    int n,k; scanf("%d%d",&n,&k);
  
    int ary[1<<18];
    int que[1<<18];
    int que2[1<<18];
    int *beg=que,*end=que;
    int *beg2=que2,*end2=que2;
    int sorted=0;
    int ans=0;

    for(int i=0; i<n; ++i)
    {
        scanf("%d",ary+i);
        int flag=0;

        if(i>=k)
        {
            if(*beg==i-k) ++beg;
            else flag=1;

            if(*beg2==i-k) ++beg2;
        }

        while(beg!=end && ary[*(end-1)]>ary[i])
        {
            --end;
        }
        *end++=i;

        while(beg2!=end2 && ary[*(end2-1)]<ary[i]) --end2;
        if(beg2!=end2) flag=1;
        *end2++=i;

        if(i<k)
        {
            flag=0;
            if(i+1==k) flag=1;
        }

        if(end-beg==k)
        {
            flag=0;
            sorted=1;
        }

        if(flag)
        {
            ans++;
            // printf("%d\n",i);
        }
    }

    ans+=sorted;
    printf("%d\n",ans);
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define MAX 502
using namespace std;
 
int m,n,b[MAX],r[MAX];
int match[MAX+MAX];
bool used[MAX+MAX];
vector<int> e[MAX+MAX];
 
bool dfs(int v){
  used[v]=true;
  for(int i=0;i<e[v].size();i++){
    int u=e[v][i],w=match[u];
    if(w<0||(!used[w]&&dfs(w))){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}
 
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  for(int i=0;i<MAX+MAX;i++){
    if(match[i]<0){
      memset(used,0,sizeof(used));
      if(dfs(i))res++;
    }
  }
  return res;
}
 
int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}
 
int main(){
  while(1){
    cin>>m>>n;
    if(!m&&!n)break;
    for(int i=0;i<m;i++)cin>>b[i];
    for(int i=0;i<n;i++)cin>>r[i];
    for(int i=0;i<m;i++)
      for(int j=0;j<n;j++)
    if(gcd(b[i],r[j])>1){
      e[i].push_back(j+m);
      e[j+m].push_back(i);
    }
    cout<<bipartite_matching()<<endl;
    for(int i=0;i<MAX+MAX;i++)e[i].clear();
  }
  return 0;
}

Measured memory_bytes: 3380
using System;
using System.Linq;

namespace ALDS1_4_A_LinearSearch
{
	class Program
	{
		static void Main ( string[] args )
		{
			//input
			int arraySize = int.Parse (Console.ReadLine ());
			int[] searchArray = new int[arraySize + 1];

			string[] inputStr = Console.ReadLine ().Split (' ');
			for (int index = 0; index < inputStr.Length; index++)
			{
				searchArray[index] = int.Parse (inputStr[index]);
			}

			int arraySize2 = int.Parse (Console.ReadLine ());
			int[] elementArray = new int[arraySize2];

			inputStr = Console.ReadLine ().Split (' ');
			for (int index = 0; index < inputStr.Length; index++)
			{
				elementArray[index] = int.Parse (inputStr[index]);
			}

			//search
			int findCount = 0;
			int lastIndex = arraySize;

			foreach (var item in elementArray)
			{
				int index = 0;
				searchArray[arraySize] = item;

				while (item != searchArray[index])
				{
					index++;
				}

				if (index != lastIndex)
				{
					findCount++;
				}
			}

			Console.WriteLine (findCount);
		}
	}
}

Measured memory_bytes: 9648
import sys
sys.setrecursionlimit(15000)
n,m = map(int,sys.stdin.readline().split())
M = list(map(int,sys.stdin.readline().split()))
dp = [float("inf")]*(n+1)
dp[0] = 0
for e in M:
  for i in range(n+1):
    if 0 <= i-e and i-e < n:
      dp[i] = min(dp[i],dp[i-e]+1)
print(dp[-1])


Measured memory_bytes: 7528
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
      //入力を受け取る
      var N = int.Parse(Console.ReadLine());
      var v = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
      Array.Sort(v);
      double sum = v[0]/Math.Pow(2,(N-1));
      for(int i = 1; i < N ; i++){
        sum += v[i]/Math.Pow(2,(N-i));
      }
      
      Console.WriteLine(sum);
    }


}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll n; cin >> n;
  vector<char> s;
  while(n!=0){
    ll t=n%26;
    if(t==0 && n==1) n=0;
    if(t==0){
      t=26;
      n-=26;
    }
    s.push_back(t+'a'-1);
    n/=26;
  }
  for(ll i=s.size()-1; i>=0; i--){
    cout << s[i];
  }
  return 0;
}

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

int main() {
    int x, n, cn;
    set<int> cs;
    cin >> x >> n;
    for (int j = 0; j < n; j++) {
        cin >> cn;
        cs.insert(cn);
    }
    for (int j = 0; j < 100; j++) {
        if (x-j >= -1 && cs.find(x-j) == cs.end()) {
            cout << x-j;
            break;
        }
        else if (x+j <= 101 && cs.find(x+j) == cs.end()) {
            cout << x+j;
            break;
        }
    }
}




Measured memory_bytes: 3596
#include<iostream>

using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	char turn = 'a';
	while (1) {
		switch (turn) {
		case 'a':
			if (a == "") {
				cout << "A\n";
				return 0;
			}
			turn = a[0];
			a = a.substr(1, a.length() - 1);
			break;
		case 'b':
			if (b == "") {
				cout << "B\n";
				return 0;
			}
			turn = b[0];
			b = b.substr(1, b.length() - 1);
			break;
		case 'c':
			if (c == "") {
				cout << "C\n";
				return 0;
			}
			turn = c[0];
			c = c.substr(1, c.length() - 1);
			break;
		}
	}
}

Measured memory_bytes: 3008
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    li a[n];

    vi cnt(1000000);

    li sum=0;

    f(i,0,n-1)
    {
        cin>>a[i];
        cnt[a[i]]++;
        sum+=a[i];
    }

    li q;

    cin>>q;

    while(q--)
    {
        li b,c;

        cin>>b>>c;

        li add=c-b;

        sum+=cnt[b]*add;

        cnt[c]+=cnt[b];
        cnt[b]=0;

        cout<<sum<<endl;
    }
}

int main()
{    
   

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

    li t=1;

    // cin>>t;

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

    return 0;
}

Measured memory_bytes: 11844
#include <bits/stdc++.h>
using namespace std;
class Dice {
    public:
        int num[6];
        void turn (char c) {
            int temp;
            if(c == 'E') {
                temp = num[0];
                num[0] = num[3];
                num[3] = num[5];
                num[5] = num[2];
                num[2] = temp;
            }
            else if(c == 'N') {
                temp = num[0];
                num[0] = num[1];
                num[1] = num[5];
                num[5] = num[4];
                num[4] = temp;
            }
            else if(c == 'S') {
                temp = num[0];
                num[0] = num[4];
                num[4] = num[5];
                num[5] = num[1];
                num[1] = temp;
            }
            else if(c == 'W') {
                temp = num[0];
                num[0] = num[2];
                num[2] = num[5];
                num[5] = num[3];
                num[3] = temp;
            }
        };
};
int main(void){
    Dice dice;
    for(int i = 0;i < 6;i++)
        scanf("%d", &dice.num[i]);
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++)
        dice.turn(s[i]);
    cout << dice.num[0] << endl;
    
}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200100];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll i,j,k,m,n;
    ll a,b;
    cin>>a>>b;
    if(fabs(a-b)<=1)
        cout<<"Brown"<<endl;
    else
        cout<<"Alice"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


const int MAX = 1000005;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}


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

    COMinit();
    int n; cin >> n;
    vector<int> a(n+1, 0), cnt(n+1, 0);
    int twice;
    rep(i, n+1){
        cin >> a[i];
        ++cnt[a[i]];
        if(cnt[a[i]]==2) twice=a[i];
    }

    int left=-1, right;
    rep(i, n+1){
        if(a[i]==twice && left==-1) left=i;
        else if(a[i]==twice) right=i;
    }

    repr(k, 1, n+2){
        ll ans = (COM(n+1, k) - ((left+n-right<k-1)?0:COM(left+n-right, k-1)));
        chmod(ans);
        cout << ans << endl;
    }


    return 0;
}


Measured memory_bytes: 25472
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int INF=1<<29;

int main(){
    ios::sync_with_stdio(false);
	ll N,Ans=1,mod=1000000007;
	string s,t;
	cin>>N>>s>>t;
	s.erase(unique(s.begin(),s.end()),s.end());
	t.erase(unique(t.begin(),t.end()),t.end());
	vector<char> arr;
	for(int i=0;i<s.length();i++){
		if(s[i]==t[i]) arr.push_back('X');
		else arr.push_back('Y');
	}
	for(int i=0;i<arr.size();i++){
		if(i==0 && arr[i]=='X') Ans*=3;
		else if(i==0 && arr[i]=='Y') Ans*=6;
		else if(arr[i-1]=='X' && arr[i]=='X') Ans*=2;
		else if(arr[i-1]=='X' && arr[i]=='Y') Ans*=2;
		else if(arr[i-1]=='Y' && arr[i]=='Y') Ans*=3;
		else if(arr[i-1]=='Y' && arr[i]=='X') Ans*=1;
		Ans%=mod;
	}
	cout<<Ans<<endl;
	return 0;
}



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

int digit(int x)
{
    int i = 0;
    int j = 1;
    while (j <= x) {
        j *= 10;
        i++;
    }
    return i;
}
int main()
{
    int m[2];
    int output;
    while (cin >> m[0] >> m[1]) {
            output = digit(m[0] + m[1]);
            cout << output << endl;
    }
}

Measured memory_bytes: 2964
#include <iostream>
using namespace std;
int main() {
   // cout<<"Hello World!";
   int n,k,count=0;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   for(int i=0;i<n;i++)
   {
       if(a[i]>=k)count++;
   }
   cout<<count;
}


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

int main() {
  int n, k, sum;
  cin >> n >> k;
  sum = 0;
  
  rep(i, n) {
    int x;
    cin >> x;
    
    if (x < abs(k-x)) {
      sum += 2*x;
    }
    else {
      sum += 2*abs(k-x);
    }
  }
  cout << sum << endl;
}


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

int main() {
	int N = 0;
	cin >> N;

	for (int i = N; i >= 1; i /= 10)
		if (i % 10 == 9) {
			cout << "Yes" << endl;
			return 0;
		}

	cout << "No" << endl;

	return 0;
}

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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B) {
		if (B == C) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	else {
		if (B == C || A == C) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int N,LOGN,n;

struct node{
	int val;
	vector<mp> sons;
	bool flag;
	void push_down(){
		if(!flag||sons.empty()){
			return;
		}
		flag=0;
		int i1,i2;
		rep(i,3)
			if(sons[i].FIR==1) i1=i;
		rep(i,3)
			if(sons[i].FIR==2) i2=i;
		swap(sons[i1].FIR,sons[i2].FIR);
	} 
}trie[2000000];
void gao(int index){
	trie[index].flag^=1;	
}
int cnt=1;
int b[13];
void build(int now,int depth,int val){
	if(depth==LOGN+1) {
//		cout<<now<<" "<<val<<endl;
		trie[now].val=val;
		return;
	}
	trie[now].sons.PB(II(0,++cnt));
	build(cnt,depth+1,val);
	trie[now].sons.PB(II(1,++cnt));
	build(cnt,depth+1,val+b[-1+depth]);
	trie[now].sons.PB(II(2,++cnt));	
	build(cnt,depth+1,val+b[-1+depth]*2);
}
void modify(int now){
//	cout<<"!" <<now<<endl;
	if(trie[now].sons.empty()) return;
	if(trie[now].flag){
	trie[now].push_down();
		rep(i,3)
		gao(trie[now].sons[i].SEC);
	}
	rep(i,3)
	{
		trie[now].sons[i].FIR++;
		trie[now].sons[i].FIR%=3;
		if(!trie[now].sons[i].FIR){
			modify(trie[now].sons[i].SEC);
		}
	}
}
int res[600000];
void recover(int now,int pos,int depth){
	if(trie[now].sons.empty()){
		res[trie[now].val]=pos;
	}
	else{	
		if(trie[now].flag){
		
		trie[now].push_down();
			rep(i,3)
			gao(trie[now].sons[i].SEC);
		}
		rep(i,3){
			recover(trie[now].sons[i].SEC,pos+b[depth-1]*trie[now].sons[i].FIR,depth+1);
		}
	}
}
int main(){
	fastio;
	cin>>N;
	n=1;
	rb(i,1,N) n*=3;
	b[0]=1;
	rb(i,1,N)
		b[i]=b[i-1]*3;
	LOGN=N;
	N=n;
	build(1,1,0);
	string T="";
	cin>>T;
	rep(INDEX,T.length()){
		bool ty=(T[INDEX]=='S');
		if(ty){
			trie[1].flag^=1;
		}
		else{
			modify(1);
		}
	}
	recover(1,0,1);
	rb(i,0,N-1)
		cout<<res[i]<<" ";
	return 0;
}


Measured memory_bytes: 97164
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,x=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    int p;
    cin>>p;
    if(p!=i){
      x++;
    }
  }
  if(x>2){
    cout<<"NO";
  }
  else{
    cout<<"YES";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

using namespace std;
int n, m, s, t;
vector<vector<pair<int, pair<long, long>>>> graph(100005);

void dijkstra(long s, vector<long> &dist, bool isYen) {
  priority_queue<pair<long, long>, vector<pair<long, long>>, greater<>> queue;
  queue.push(make_pair(0, s));
  while (!queue.empty()) {
    pair<long, int> p = queue.top();
    queue.pop();
    long d = p.first;
    int start = p.second;
    if (d > dist.at(start)) {
      continue;
    }
    for (auto e : graph.at(start)) {
      int end = e.first;
      long cost = isYen ? e.second.first : e.second.second;
      if (dist.at(end) > d + cost) {
        dist.at(end) = d + cost;
        queue.push(make_pair(dist.at(end), end));
      }
    }
  }
}

int main() {
  cin >> n >> m >> s >> t;
  for (int i=1; i<=m; i++) {
    int u,v;
    long a,b;
    cin >> u >> v >> a >> b;
    graph.at(u).push_back(make_pair(v, make_pair(a, b)));
    graph.at(v).push_back(make_pair(u, make_pair(a, b)));
  }

  vector<long> dist1(n+1);
  vector<long> dist2(n+1);
  for (int i=1; i<=n; i++) {
    dist1.at(i) = LONG_MAX;
    dist2.at(i) = LONG_MAX;
  }
  dist1.at(s) = 0;
  dist2.at(t) = 0;

  dijkstra(s, dist1, true);
  dijkstra(t, dist2, false);

  vector<long> dvec(n+1);
  dvec.at(n) = dist1.at(n) + dist2.at(n);
  for (int i=n-1; i>=1; i--) {
    dvec.at(i) = dist1.at(i) + dist2.at(i);
    dvec.at(i) = min(dvec.at(i), dvec.at(i+1));
  }
  long init = 1;
  for (int i=1; i<=15; i++) {
    init *= 10;
  }
  for (int i=1; i<=n; i++) {
    cout << init-dvec.at(i) << endl;
  }
}


Measured memory_bytes: 13124
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int a[1000];
signed main()
{
	int n;
  cin>>n;
  for(int i=1;i<=n;i++)
    	cin>>a[i];
  int s=0;
  for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)
      s+=a[i]*a[j];
  printf("%lld\n",s);
}

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

int main(void){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a%2==1){
		if(b%2==1){
			printf("Odd");
			return 0;
		}else{
			printf("Even");
			return 0;
		}
	}
	printf("Even");

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstring> 
#include<cstdio>
#include<algorithm>
#include<stack>
using namespace std;
int a,b,k,ans;
int main()
{
	scanf("%d%d%d",&a,&b,&k);
	for(int i=min(a,b);;--i)
	{
		if(a%i==0&&b%i==0)k--;
		if(k==0)
		{
			ans=i;
			break;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  long long n;
  cin>>n;
  string ans="";
  while(n){
    if (n%26==0){
      ans+='z';
      n--;
    }
    else ans+=(char)((n%26)-1)+'a';
    n/=26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define has(c, i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i >= a; i--)

vvl c;
ll x = 0;

void search(vl &res, ll i) {
  if(res[i] != -1)
    return;
  res[i] = 0;
  for(auto a:c[i]) {
    search(res, a);
    res[i] = max(res[i], res[a] + 1);
    x = max(res[i], x);
  }
}

int main() {
  cout << fixed << setprecision(8);
  ll n, m;

  cin >> n >> m;

  c = vvl(n);

  FOR(i,0,m) {
    ll x, y;
    cin >> x >> y;
    --x; --y;
    c[x].pb(y);
  }

  vl res(n, -1);

  FOR(i,0,n) {
    search(res, i);
  }

  cout << x << endl;
}


Measured memory_bytes: 8576
import java.util.Scanner;

public class Main{


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

}

Measured memory_bytes: 26344
#include<stdio.h>
int main(){
  int a, b;
  int c, d, e, f;
  scanf("%d%d",&a,&b);
  c=a+b;
  d=a-b;
  e=a*b;
  
  if(c<d){
    if(d<e){
      f=e;
    }else{
      f=d;
    }}else if(c<e){
      f=e;
    }else{
      f=c;
    }
  
printf("%d",f);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    string s;
    cin >> s;
    int res = 7;
    if (s[0] == 'o') res++;
    if (s[1] == 'o') res++;
    if (s[2] == 'o') res++;
    cout << res*100 << endl;
 return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
ans = [[0 for i in range(w)] for k in range(h)]

noww = 0
nowh = 0
check = 1 #1の時左から右に塗って行く
for i in range(n):
	while a[i] != 0:
		if check == 1 and noww+a[i] > w:
			for k in range(w-noww):
				ans[nowh][noww+k] = i+1
			a[i] = a[i]-(w-noww)
			noww = w
			nowh += 1
			check = check*(-1)
		elif check == -1 and noww-a[i] < 0:
			for k in range(noww):
				ans[nowh][noww-k-1] = i+1
			a[i] = a[i]-(noww)
			nowh += 1
			noww = 0
			check = check*(-1)
		elif check == 1:
			for k in range(a[i]):
				ans[nowh][noww+k] = i+1
			noww = noww+a[i]
			a[i] = 0
			if noww == w:
				nowh += 1
				check = check*(-1)
		else:
			for k in range(a[i]):
				ans[nowh][noww-k-1] = i+1
			noww = noww-a[i]
			a[i] = 0
			if noww == 0:
				nowh += 1
				check = check*(-1)
for i in range(h):
	for k in range(w):
		if k != w-1:
			print(ans[i][k],end=" ")
		else:
			print(ans[i][k])

Measured memory_bytes: 3956
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	switch {
	case a < b:
		fmt.Println("a < b")
	case a > b:
		fmt.Println("a > b")
	case a == b:
		fmt.Println("a == b")
	}
	return
}


Measured memory_bytes: 1148
import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {

        // long startTime = System.currentTimeMillis();

        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();

        scanner.close();

        int ac = Math.abs(a - c);
        if (ac <= d) {
            System.out.println("Yes");
            return;
        }
        int ab = Math.abs(a - b);
        int bc = Math.abs(b - c);
        if (ab <= d && bc <= d) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");

        // System.out.println(System.currentTimeMillis() - startTime);
    }
}

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

int min1(int a, int b, int c)
{
	return (max(a,max(b,c)));
}
int k;
int main()
{
	int n;
	cin >> n;
	vector<vector<int> > arr(n,vector<int> (3));
	vector<vector<int> > dp(n,vector<int> (3,0));
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<3; j++)
		{
			cin >> arr[i][j];
		}
	}
	for (int i=0; i<3; i++)
	{
		dp[0][i]=arr[0][i];
	}
	for (int i=1; i<n; i++)
	{
		dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=arr[i][1]+max(dp[i-1][2],dp[i-1][0]);
		dp[i][2]=arr[i][2]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << min1(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
	return 0;
}

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

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

  if (s.size() <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) + "..." << endl;
  }

  return 0;
}

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

int main() {
    string S;
    cin >> S;
    int len = S.size();

    int cnt1 = 0;
    char c1 = '0';
    for(int i=0; i<len; i++) {
        if(S[i] != c1) {
            cnt1++;
        }
        if(c1 == '0') c1 = '1';
        else c1 = '0';
    }

   int cnt2 = 0;
    char c2 = '1';
    for(int i=0; i<len; i++) {
        if(S[i] != c2) {
            cnt2++;
        }
        if(c2 == '0') c2 = '1';
        else c2 = '0';
    }
    if(cnt1>cnt2) cout << cnt2 << endl;
    else cout << cnt1 << endl;

    return 0;
}

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

#define pb push_back
#define all(a) a.begin(), a.end()

using ll = long long;
using pii = pair<int, int>;

const int inf = 1e9;

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int N, M, P; cin >> N >> M >> P;
    vector<vector<pii>> g1(N);
    vector<vector<int>> g2(N);
    for (int i = 0; i < M; ++i) {
        int A, B, C; cin >> A >> B >> C;
        --A, --B;
        C -= P;
        g1[A].pb({B, C});
        g2[B].pb(A);
    }
    // find vertices which can reach N
    vector<bool> reachN(N, false);
    reachN[N - 1] = true;
    queue<int> Q;
    Q.push(N - 1);
    while (!Q.empty()) {
        int u = Q.front(); Q.pop();
        for (int v : g2[u]) {
            if (!reachN[v]) {
                reachN[v] = true;
                Q.push(v);
            }
        }
    }
    // longest path from 1 to v (modify floyd warshall)
    vector<int> dist(N, -inf);
    dist[0] = 0;
    for (int i = 0; i < N - 1; ++i) {
        for (int u = 0; u < N; ++u) {
            for (auto v : g1[u]) {
                if (dist[u] > -inf) {
                    if (dist[v.first] < dist[u] + v.second) // edge relaxation
                        dist[v.first] = dist[u] + v.second;
                }
            }
        }
    }
    // check for negative weight cycle
    for (int u = 0; u < N; ++u) {
        for (auto v : g1[u]) {
            if (dist[u] > -inf) {
                if (dist[v.first] < dist[u] + v.second && reachN[v.first]) {
                    cout << -1 << "\n";
                    return 0;
                }
            }
        }
    }
    cout << max(0, dist[N - 1]) << "\n";
}

Measured memory_bytes: 512
N,M = map(int,input().split())
Alist = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    Alist.append(array)
Alist.sort()
q = 0
p = [Alist[0][0],Alist[0][1]]
for i in range(len(Alist)-1):
    if p[0] < Alist[i+1][0]:
        p[0] = Alist[i+1][0]
    if p[0] >= p[1]:
        q = q+1
        p = [Alist[i+1][0],Alist[i+1][1]]
    if p[1] > Alist[i+1][1]:
        p[1] = Alist[i+1][1]
print(q+1)

Measured memory_bytes: 27888
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define F       first
#define S       second
#define _READ   freopen("input.txt","r", stdin);
#define _FAST   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve()
{
    int n,i,j,x;
    cin>>x>>n;
    vector<int> ar(n);
    for(auto &i1:ar)
        cin>>i1;
    sort(ar.begin(),ar.end());
    for( i=x,j=x;;i--,j++)
    {
        if(binary_search(ar.begin(),ar.end(),i) && binary_search(ar.begin(),ar.end(),j))
            continue;
        
        if(!binary_search(ar.begin(),ar.end(),i) 
            && binary_search(ar.begin(),ar.end(),j))
        {
            cout<<i;
            return ;
        }if(binary_search(ar.begin(),ar.end(),i) 
            && !binary_search(ar.begin(),ar.end(),j))
        {
            cout<<j;
            return ;
        }
        
        
        int t=abs(x-i);int y=abs(x-j);
        if(t<y)
            cout<<i;
        else if(y<t)
            cout<<j;
        else
        {
            cout<<min(i,j);
        }
        
        //cout<<min(t,y);
        return ;
    }
}
int32_t main()
{
    
    //_READ
    
    int t;
    t=1;
    while(t--)
        solve();

    return 0;
}
/*
===FOR N-Dimensional Vector===
https://codeforces.com/blog/entry/76149
g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined a.cpp -o a -D_GLIBCXX_DEBUG
*/

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define N 100010
using namespace std;
int nxt[N<<1],to[N<<1],head[N],cnt;
void add(int u,int v)
{
	nxt[++cnt]=head[u];
	to[cnt]=v;
	head[u]=cnt;
}
int f[N][21],ans;
void dfs(int u,int pre)
{
	for(int i=head[u];i;i=nxt[i])
	{
		int v=to[i];
		if(v==pre) continue;
		dfs(v,u);
		for(int j=0;j<=20;j++) f[u][j]+=f[v][j];
	}
	int pmin=0;
	for(int j=20;j>=0;j--)
	if(pmin)f[u][j]=0;
	else if(f[u][j]>=2) pmin=j;
	while(!pmin || f[u][pmin]>=2) f[u][pmin]=0,f[u][++pmin]++;
	ans=max(ans,pmin);
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	dfs(1,0);
	printf("%d",ans-1);
	return 0;
}


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

int main(){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=10000;i++){
        int c=i*0.08;
        int d=i*0.1;
        if(c==a && d==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val a = readInt() 
    val b = readInt()
    val c = readInt()
    val d = readInt()

    val ans = Math.min(a, b) + Math.min(c, d)
    println(ans)
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 31748
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);

        int total1 = inp.nextInt();

        int[] list1 = new int[total1];

        for(int i = 0; i < total1; i++){
            list1[i] = inp.nextInt();
        }

        Arrays.sort(list1);

        int total2 = inp.nextInt();

        int[] list2 = new int[total2];

        for(int i = 0; i < total2; i++) {
            list2[i] = inp.nextInt();
        }

        Arrays.sort(list2);

        ArrayList<Integer> sameList = new ArrayList<>();

        for (int i : list1) {
            int tempNum;

            String tempString = binarySearch(list2, list2.length, i);

            if (tempString != null) {
                tempNum = Integer.parseInt(tempString);

                if (!(sameList.contains(tempNum))) {
                    sameList.add(tempNum);
                }
            }
        }

        System.out.println(sameList.size());
    }

    public static String binarySearch(int[] list, int n, int t) {
        int l = 0;
        int r = n-1;

        while (l <= r) {
            int mid = (int) Math.floor((l + r) / 2);

            if (list[mid] < t) {
                l = mid + 1;
            } else if (list[mid] > t) {
                r = mid - 1;
            } else if (list[mid] == t) {
                return list[mid] + "";
            }
        }

        return null;
    }
}



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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){ if(a>b) a=b;}



int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m, ans=0;
	cin >>n >>m;
	if(m>=n) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;
long long int MOD = 1000000007;

using namespace std;

int main(){
	
	int N, W;
	cin >> N >> W;
	
	int w[300];
	
	for(int i = 0; i < N; i++){
		cin >> w[i];
	}
	
	sort(w, w + N);
	
	int S = 0;
	long long int ans = 0;
	for(int i = 0; i < N; i++){
		int L = W - w[i];
		long long int DP[11000] = {};
		if(S > W){
			break;
		}
		DP[S] = 1;
		for(int j = i + 1; j < N; j++){
			for(int k = W; k >= w[j]; k--){
				DP[k] += DP[k - w[j]];
				DP[k] %= MOD;
			}
		}
		for(int j = W - w[i] + 1; j <= W; j++){
			ans += DP[j];
			ans %= MOD;
		}
		S += w[i];
	}
	
	if(S <= W){
		ans += 1;
		ans %= MOD;
	}
	
	cout << ans << endl;
	
	return 0;
}


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

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

  int l = S.size();
  for (int i = 2 - l % 2; i <= l - 2; i = i + 2) {
    int sp = (S.size() - i) / 2;
    if (S.substr(0, sp) == S.substr(sp, sp)) {
      cout << S.size() - i << endl;
      return 0;
    }
  }
  return 0;
}

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

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

	if (x == 2 || y == 2) {
		cout << "No" << endl;
	}
	else if (((x % 2 == 1 && x <= 7) || (x % 2 == 0 && x >= 8)) && ((y % 2 == 1 && y <= 7) || (y % 2 == 0 && y >= 8))) {
		cout << "Yes" << endl;
	}
	else if (((x % 2 == 0 && x <= 6) || (x % 2 == 1 && x >= 9)) && ((y % 2 == 0 && y <= 6) || (y % 2 == 1 && y >= 9))) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    cin >> n;
    vector<ll> v;
    for(int i=0;i<n*3;i++){
        ll foo;
        cin >> foo;
        v.push_back(foo);
    }
    sort(all(v));
    ll sum = 0;
    for(int i=n,c=1;c<=n;c++,i+=2){
        sum += v[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
 
int main() {
  string s;
  cin >> s;
  ll sum = 0;
  rep(i,s.size()) {
    sum += stoi(s.substr(i,1));
  }
  if (sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3748
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main(){
	ll n;
	cin >> n;
	vector<pair<ll, ll>> a(n);
	rep(i,n){
		ll s, t;
		cin >> s >> t;
		a[i] = make_pair(t, s);
	}
	sort(all(a));
	ll t = 0;
	rep(i,n){
		t += a[i].second;
		if(t > a[i].first){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 3456
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int a[50][2];
int dp[50];
int num[maxn];
int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<(n/(a+b))*a+min(n%(a+b),a)<<endl;
	return 0;
}



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

using namespace std;

int main() {
 int R[110],n,j,v;
 cin >> n;

 for(int i = 0; i<n; i++){
   cin >> R[i];
 }
 for(int i = 0; i<n; i++){
   if(i == (n-1)) {cout << R[i] << endl;}
   else {cout << R[i]<< " ";}
 }
 for(int k=1; k<n;k++){
  v = R[k];
  j = k-1;
  while(j>=0&&R[j]>v){
    R[j+1] = R[j];
    j--;
    R[j+1] = v;
  }
  for(int i = 0; i<n; i++){
     if(i == (n-1)) {cout << R[i] << endl;}
     else {cout << R[i]<< " ";}
  }
 }
}


Measured memory_bytes: 3084
#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() {
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    if (s == "Cloudy") cout << "Rainy" << endl;
    if (s == "Rainy") cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a[] = new int[3];
        for(int i=0; i<3; i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[2]*10 + a[1] + a[0]);
    }
}


Measured memory_bytes: 21204
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String args[]) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int a[]=new int[n];
        int b[]=new int[n];
        int c[]=new int[n];
        for(int i=0;i<n;i++) {
            a[i]=input.nextInt();
            b[i]=input.nextInt();
            c[i]=input.nextInt();
        }
        System.out.println(solve(n,a,b,c));
    }
    public static int solve(int n,int a[],int b[],int c[]) {
        int dp[][]=new int[3][n];   //0->a  1->b    2->c
        dp[0][0]=a[0];
        dp[1][0]=b[0];
        dp[2][0]=c[0];
        for(int i=1;i<n;i++) {
            dp[0][i]=Math.max(dp[1][i-1],dp[2][i-1])+a[i];
            dp[1][i]=Math.max(dp[0][i-1],dp[2][i-1])+b[i];
            dp[2][i]=Math.max(dp[0][i-1],dp[1][i-1])+c[i];
        }
        return Math.max(dp[0][n-1],Math.max(dp[1][n-1],dp[2][n-1]));
    }
}


Measured memory_bytes: 92908
a,b,c,x,y = map(int, input().split())

# 合計料金
total = 0

# import ipdb; ipdb.set_trace()

same_amount = min(x,y)

x -= same_amount
y -= same_amount

# AB2枚とA,Bを1枚ずつどちらがお得か
if a+b > 2*c:
    # AB2枚の方がお得の時
    total += 2*c*same_amount
else:
    # A,B1枚ずつの方がお得の時
    total += (a+b)*same_amount

# 残りも全てABを買ったほうが良いか確認
if (x*a + y*b) > (2*(x+y)*c):
    total += (2*(x+y)*c)
else:
    # 残ったピザを１枚ずつ買う
    total += (x*a + y*b)

print(total)



Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main(void){
	int n, x=0, max=0, i;
	char s[105];
	cin >> n>>s;
	for (i = 0; i <= n; i++) {
		if (s[i] == 'I')
			x++;
		else
			x--;
		if (x > max)
			max = x;
	}
	cout << max << endl;
	return 0;
}
	
	

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int A,B,C,K;
int main(){
    cin >> A >> B >> C;
    cin >> K;
    if(A >= B && A >= C){
        for(int i = 1; i <= K; i++){
            A *= 2;
        }
    }else if(B >= A && B >= C){
        for(int i = 1; i <= K; i++){
            B *= 2;
        }
    }else if(C >= A && C >= B){
        for(int i = 1; i <= K; i++){
            C *= 2;
        }
    }
    cout << A + B + C << endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())printf("%d ",v[_]);cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

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

  string s;
  cin>>s;
  int c=0;
  rep(i,s.size())if(s[i]=='x')c++;
  if(c>=8)no;
  else yes;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class ELISDL {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        ll n,a,b;
        in>>n>>a>>b;
        if(a+b>n+1||a*b<n){
            out<<-1<<endl;
            return;
        }
        vector<int> ans(b);
        int k=n;
        ifr(i,b){
            if(i+a<k) ans[i]=a;
            else ans[i]=k-i;
            k-=ans[i];
        }
        k=n;
        fr(i,b){
            for(int j=k-ans[i]+1;j<=k;++j) out<<j<<" ";
            k-=ans[i];
        }
        out<<endl;
    }
};

int main() {
    ELISDL solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2816
//                                      KiSmAt
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 2 * 1e5 + 10;

ll res;
ll a[N], dp[N];

void solve(){
	ll n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
	}
	for(int i = 2; i < N; ++i){
		dp[i] = inf;
	}
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= k; ++j){
			if(i - j > 0){
				dp[i] = min(dp[i - j] + abs(a[i] - a[i - j]), dp[i]);
			}
		}
	}
	cout << dp[n];
}
 
int main(int argc, char const *argv[]){
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
    	solve();
    }
}
// nEro

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000

int n,A[MAX+1],L[MAX];
int lis(){
  L[0]=A[0];
  int length=1;
  for(int i=1;i<n;i++){
    if(L[length-1]<A[i]){L[length++]=A[i];}
    else{*lower_bound(L,L+length,A[i])=A[i];}
  }
  return length;
}

int main(){
  cin >> n;
  for(int i=0;i<n;i++)cin >> A[i];
  cout << lis() << endl;
}


Measured memory_bytes: 3768
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
int x,y,z;
int main ()
{
	scanf("%d%d%d",&x,&y,&z);
	printf("%d\n",(x-y)%z);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int i, j;
		int[] sum = new int[n];
		int[] product = new int[m];
		int[][] A = new int[n][m];
		int[] b = new int[m];
		int[] c = new int[n];
		for (i = 0; i < A.length; i++) {
			for (j = 0; j < A[i].length; j++) {
				A[i][j] = sc.nextInt();
			}
		}
		for (j = 0; j < b.length; j++) {
			b[j] = sc.nextInt();
		}
		for (i = 0; i < A.length; i++) {
			for (j = 0; j < A[i].length; j++) {
				product[j] = A[i][j] * b[j];
				sum[i] += product[j];
			}
			c[i] = sum[i];
		}
		for (i = 0; i < c.length; i++) {
			System.out.println(c[i]);
		}
		sc.close();
	}
}


Measured memory_bytes: 40692