akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int a;
	vector<int>l;
	while (cin >> a){
		if (a == 0) 
			break;
		int x = 0;
		while (a != 1){
			if (a % 2 == 1)
				a = a * 3 + 1;
			else a /= 2;
			x += 1;
		}
		l.push_back(x);
	}
	for (int i = 0; i != l.size(); i++)
	{
		cout << l[i] << endl;
	}
}

Measured memory_bytes: 3132
#include <iostream>
#include <string>

using namespace std;

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    int ful = r * 100 + g * 10 + b * 1;
    if (ful % 4 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
long long sum,i,c=0;
long long X;
cin>>X;
sum=100;
for(i=1;i<=X;i++)
{
    c++;
    sum=sum+sum/100;
    if(sum>=X)
    {
        cout<<c<<endl;
        break;
    }
}
}


Measured memory_bytes: 3164
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int n, m, N[1000], M[1000], temp[1000] = {0};
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		scanf("%d", &N[i]);
	}
	for (int i = 0; i < m; i++){
		scanf("%d", &M[i]);
	}
	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			if (N[j] <= M[i]){
				 temp[j]++;
				 break;
			}
		}
	}
	int count = temp[0], ans = 1;
	for (int i = 1; i < n; i++){
		if (count < temp[i]){
			count = temp[i];
			ans = i+1;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3208
class Node():
    def __init__(self, value, parent=None):
        self.value = value
        self.parent = parent
        self.left = None
        self.right = None

class BinaryTree():
    def __init__(self):
        self.root = None
    
    def insert(self, value):
        if self.root == None:
            self.root = Node(value)
        else:
            parentnode = curnode = self.root
            while curnode != None:
                parentnode = curnode
                if curnode.value > value:
                    curnode = curnode.left
                else:
                    curnode = curnode.right
            if value > parentnode.value:
                parentnode.right = Node(value)
            else:
                parentnode.left = Node(value)

    def find(self, value):
        curnode = self.root
        while curnode != None:
            if curnode.value == value:
                return True
            elif curnode.value < value:
                curnode = curnode.right
            else:
                curnode = curnode.left
        return False

    def preorder(self, root):
        if root == None:
            pass
        else:
            print(' %d' % root.value, end='')
            self.preorder(root.left)
            self.preorder(root.right)

    def inorder(self, root):
        if root == None:
            pass
        else:
            self.inorder(root.left)
            print(' %d' % root.value, end='')
            self.inorder(root.right)

if __name__ == '__main__':
    n = int(input())
    binarytree = BinaryTree()
    for _ in range(n):
        common = input()
        if common[0] == 'i':
            binarytree.insert(int(common[7:]))
        elif common[0] == 'f':
            if binarytree.find(int(common[5:])):
                print('yes')
            else:
                print('no')
        else:
            binarytree.inorder(binarytree.root)
            print()
            binarytree.preorder(binarytree.root)
            print()


Measured memory_bytes: 85224
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

const int INF = 1e9;


// code
// ------------------------------------------------
int main() {
  int n,x;
  cin >> n >> x;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vsort(a);
  bool flg = false;
  int ans = 0;

  int sum = 0;

  rep(i,n)
  {
    sum += a[i];
    if(x < sum)
      break;
    ans++;
  }

  if ( x > sum)
      ans--;

  cout << ans ;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut s = read::<String>().chars().collect::<Vec<char>>();
    let n = s.len();
    s.push('R');
    let mut anss = vec![0; n];
    let mut state = 0;
    let mut cnts = vec![0, 0];
    let mut center = 0;
    for i in 0..n + 1 {
        if state == 1 && s[i] == 'R' {
            state = 0;
            anss[center] = cnts[center % 2];
            anss[center - 1] = cnts[(center + 1) % 2];
            cnts[0] = 0;
            cnts[1] = 0;
            cnts[i % 2] = 1;
            continue;
        }
        cnts[i % 2] += 1;
        if state == 0 && s[i] == 'L' {
            state = 1;
            center = i;
        }
    }
    for i in 0..n {
        if i != 0 {
            print!(" ");
        }
        print!("{}", anss[i]);
    }
    println!("");
}


Measured memory_bytes: 4476
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int n;
    cin >> n;
    cout << n * n * n << endl;

    return 0;
}

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

// for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

// abbreviati
#define PB(v) push_back(v)
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

// constant
const int INF = 1<<30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet***************************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin,chmax
**************************************************************/

// adjacency list
vector<int> to[100005];

// Graph
using Graph = vector<vector<int>>;

// Grid
int H,W;
vector<vector<int>> field;

// 4方向への移動ベクトル
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll x,k,d; cin >> x >> k >> d;
    x=abs(x);
    ll ans=0;
    if(x/d>k){
        ans=x-d*k;
    }else{
        ll e=x/d;
        k-=e;
        x-=e*d;
        if(k%2==1) x=abs(x-d);
        ans=x;
    }

    cout << ans ENDL;
    // rep(i,0,k){
    //     if(abs(x)<=d) break;
    //     if(x>0){
    //         x=x-d;
    //     }else{
    //         x=x+d;
    //     }
    //     //cout << "now:" << x ENDL;
    // }

    // if(abs(x)==d){
    //     cout << d ENDL;
    // }else if(x>0){
    //     ll temp=(ll)x/d;
    //     if(temp<=k){
    //         if(x%d==0){
    //             cout << 0 ENDL;
    //         }else{
    //             cout << x%d ENDL;
    //         }
    //         //cout << (x-(ll)(temp)*d) ENDL;
    //     }else{
    //         //cout << 
    //         cout << (x-(ll)d*k) ENDL;
    //     }
    // }else if(x<0){
    //     ll temp=(ll)x/d;
    //     if(temp<=k){
    //         if(x%d==0){
    //             cout << 0 ENDL;
    //         }else{
    //             cout << x%d ENDL;
    //         }
    //         //cout << 0-(x+(ll)(temp)*d) ENDL;
    //     }else{
    //         cout << 0-(x+(ll)(d*k)) ENDL;
    //     }
    // }else{
    //     cout << 0 ENDL;
    // }
    //cout << abs(x) ENDL;


    return 0;
}

Measured memory_bytes: 5964
import numpy as np
n = int(input())
h = np.array(list(map(int, input().split())))
ans = 0
while (any(h > 0)):
  count = 0
  for i in range(n-1):
    if h[i] > 0 and h[i + 1] <= 0:
      count += 1
  if h[n-1] > 0:
    count += 1
  ans += count
  h -= 1
print(ans)

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

int main(){
	int num[30] = {0}, i,a;
	for(i=0;i<28;i++){
		cin>>a;
		num[a-1]++;
	}
	for(i=0;i<30;i++){
		if(num[i] == 0)cout << i+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
def solve():
    s = input()
    n = len(s)

    for i in range(n // 2):
        if s[i] != s[n - 1 - i]:
            print("No")
            return
    
    for i in range((n - 1) // 2):
        if s[i] != s[(n - 1) // 2 - 1 - i]:
            print("No")
            return
    
    for i in range((n + 3) // 2, n):
        if s[i] != s[n - 1 - i]:
            print("No")
            return
    
    print("Yes")

    return

if __name__ == "__main__":
    solve()

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

// Description: ????????????
// Verifyed: various problem 
const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
const P O=0.0L;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P p;R c;};

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline int sdot(P o,P a,P b){return sgn(dot(o,a,b));}
inline int sdet(P o,P a,P b){return sgn(det(o,a,b));}

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/(l.t-l.s)); return (1-u)*l.s+u*l.t;}

// vertical parallel
// verified: AOJ CGL_2_A
bool vertical(L a,L b) {return sdot(O,a.t-a.s,b.t-b.s)==0;}
bool parallel(L a,L b) {return sdet(O,a.t-a.s,b.t-b.s)==0;}
bool eql(L a,L b){ return parallel(a,b) and sdet(a.s,a.t,b.s)==0;}

// crossing determination
// verified: AOJ CGL_2_B 
bool iss(L a,L b){
	int sa=sdet(a.s,a.t,b.s)*sdet(a.s,a.t,b.t);
	int sb=sdet(b.s,b.t,a.s)*sdet(b.s,b.t,a.t);
	return max(sa,sb)<0;
}

// crossing point 
// verified: AOJ CGL_2_C
P cross(L a,L b){
	R u=det(a.s,b.s,b.t)/det(O,a.t-a.s,b.t-b.s);
	return (1-u)*a.s+u*a.t;
}
	
// distance 
// verified: AOJ CGL_2_D
R dsp(L l,P p){
	P h=proj(l,p);
	if(sdot(l.s,l.t,p)<=0) h=l.s;
	if(sdot(l.t,l.s,p)<=0) h=l.t;
	return abs(p-h);
}

R dss(L a,L b){return iss(a,b)?0:min({dsp(a,b.s),dsp(a,b.t),dsp(b,a.s),dsp(b,a.t)});}

istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

int main(void){
	int n;
	cin >> n;
	cout.precision(20);
	rep(i,n){
		P a,b,c,d;
		cin >> a >> b >> c >> d;
		L s1={a,b},s2={c,d};
		R ans=dss(s1,s2);
		cout << fixed << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3280
#include<iostream>
#include<algorithm>
#include<stack>
#define X first
#define Y second
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair <ll,ll> ii;
const int N=200003;
ll n,j,a[N],l[N],r[N];
ll ans=0;
stack <ii> S;
int main()
{
	   cin>>n;
	   FOR(i,1,n) cin>>a[i];
	   FOR(i,1,n) 
	     {
                while(!S.empty() && S.top().X>a[i] ) S.pop();
                if(S.empty()) l[i]=i-1;
                else l[i]=i-S.top().Y-1;
                S.push(ii(a[i],i));  
         }
       while(!S.empty()) S.pop(); 
	   for(int i=n;i>0;i--)
	     {
                while(!S.empty() && S.top().X>a[i] ) S.pop();
                if(S.empty()) r[i]=n-i;
                else r[i]=S.top().Y-i-1;   
                S.push(ii(a[i],i));
         }
       FOR(i,1,n) ans+=( l[i]+r[i]+ l[i]*r[i]+1 )*a[i];  
	   cout<<ans;
	 //  system("pause");
	   return 0; 
}


Measured memory_bytes: 8192
N = int(input())
H = list(map(int, input().split()))
result = []
count = 0
i = 0

for i in range (N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    result.append(count)
    count=0

"""
while i <= N-2:#Hの最終インデックスはN-1、最終インデックスの探索は不要なのでN-2とする
  if H[i] >= H[i+1]:
    count += 1
    i += 1
  else:
    result.append(count)
    i += count+1
    count = 0
"""

result.append(count) #最終インデックスが絡む部分は上記while内ではappendされないため

print(max(result))

Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    string s;
    cin >> s;
    ll n = s.size();
    ll sum = 0;
    rep1(i, n){
        ll cnt = s[i] - '0';
        sum += cnt;
        sum %= 9;
    }
    if (sum%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    //printf("%.12f", ans);
}

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

int main(){
    int n,i;
    cin >> n;

    int A[n],dp[n];
    
    for(i=0;i<n;i++)
        cin >> A[i];

    dp[0]=0;
    dp[1]=abs(A[0]-A[1]);

    for(i=2;i<n;i++)
        dp[i] = min(dp[i-2] + abs(A[i]-A[i-2]), dp[i-1] + abs(A[i]-A[i-1]));

    cout << dp[n-1] << endl;

    return 0;
}

Measured memory_bytes: 4328
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

const int MAX = 500010;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void init(){
  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;
  }
}

ll nCr(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;
}

ll nHr(int n,int k){
  return nCr(n+k-1,k);
}

int main(){
  ll n,m;
  cin>>n>>m;
  
  init();
  
  map<ll,ll> p;
  
  ll a=m;
  for(ll i=2;i*i<=m;i++){
    while(a%i==0){
      p[i]++;
      a/=i;
    }
  }
  if(a!=1) p[a]++;
  
  ll ans=1;
  for(auto x:p){
    ans=ans*nHr(n,x.second)%MOD;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 15340
import java.util.Scanner;
public class Main {

	static Scanner sc = new Scanner(System.in);

	static char[][] field;
	static int x, y;
	static int m, n;
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
	
		while(read()){
			solve();
		}
		
	}
	
	static boolean read(){
		
		y = sc.nextInt();
		x = sc.nextInt();
		
		if(x == 0 || y == 0) return false;
		
		field = new char[y][x];
		
		for(int i=0; i < field.length; i++)
		{
			field[i] = sc.next().toCharArray();
		}
		
		return true;
	}
	
	static void solve(){
		m= 0;
		n=0;
		while(field[m][n] != '.'){

			if(field[m][n] == '<' ){
				field[m][n] = '*';
				n--;
			}
			else if(field[m][n] == '>' ){
				field[m][n] = '*';
				n++;
			}
			else if(field[m][n] == '^' ){
				field[m][n] = '*';
				m--;
			}
			else if(field[m][n] == 'v'){
				field[m][n] = '*';
				m++;
			}
			else if(field[m][n] == '*'){
				System.out.println("LOOP");
				return;
			}

		}
		
		System.out.println(n + " " + m);
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> G(h + 1);
  rep(i, h) {
    string s;
    cin >> s;
    s = "." + s;
    G[i + 1] = s;
  }
  string s = "";
  rep(i, w + 1) { s += "."; }
  G[0] = s;
  int dp[h + 1][w + 1];
  rep(i, h + 1) dp[i][0] = 0;
  rep(i, w + 1) dp[0][i] = 0;
  repi(i, 1, h + 1) {
    repi(j, 1, w + 1) {
      if (i == 1 && j == 1) {
        if (G[i][j] == '#')
          dp[i][j] = 1;
        else
          dp[i][j] = 0;
        continue;
      }
      int up = dp[i - 1][j];
      int left = dp[i][j - 1];
      if (G[i - 1][j] != G[i][j]) up++;
      if (G[i][j - 1] != G[i][j]) left++;
      if (i - 1 == 0) up = INF;
      if (j - 1 == 0) left = INF;
      dp[i][j] = min(up, left);
    }
  }
  /* repi(i, 1, h + 1) {
    repi(j, 1, w + 1) { cout << dp[i][j]; }
    cout << endl;
  } */
  if (G[h][w] == '#') dp[h][w]++;
  cout << dp[h][w] / 2 << endl;
  return 0;
}


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

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

  int n;
  cin >> n;
  int l[100010][3];
  rep(i, n) rep(j, 3) cin >> l[i][j];

  int dp[100010][3] = {};
  rep(i, n) {
    rep(j, 3) {
      rep(k, 3) {
        if (j == k) continue;
        dp[i+1][j] = max(dp[i+1][j], dp[i][k] + l[i][j]);
      }
    }
  }

  int ans = 0;
  rep(i, 3) ans = max(ans, dp[n][i]);
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ll n, d, a, x, h, p = 0LL, ans = 0LL;
  vector<pair<ll, ll> > v;
  scanf("%lld%lld%lld", &n, &d, &a);
  vector<ll> sum(n + 2);
  sum[0] = 0;
  for (ll i = 0; i < n; i++) {
    scanf("%lld%lld", &x, &h);
    v.push_back({x, h});
    sum[i + 1] = 0LL;
  }
  sort(v.begin(), v.end());
  for (ll i = 0; i < n; i++) {
    sum[i + 1] += sum[i];
    if (sum[i + 1] < (v[i].second + a - 1) / a) {
      while (p < n && v[p].first <= v[i].first + 2 * d) {
        p++;
      }
      sum[p + 1] -= ((v[i].second + a - 1) / a - sum[i + 1]);
      ans += ((v[i].second + a - 1) / a - sum[i + 1]);
      sum[i + 1] += ((v[i].second + a - 1) / a - sum[i + 1]);
    }
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 7536
#include<cstdio>

using namespace std;

int main()
{
	int n;
	
	scanf("%d", &n);

	if (n == 3 || n == 5 || n == 7)
	{
		printf("YES\n");
	}

	else
	{
		printf("NO\n");
	}

	return 0;
}

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

string s;
int cnt=0;
int ans;

int main(){
    cin>>s;
    for (int i = 0; i < 3; i++)
    {
        if(s[i] == 'o') cnt++;
    }
    
    ans = 700 + cnt*100;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n;cin>>n;
    int count13=0;int count2=0;int count0=0;
    ll x;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x%4==2)count2++;
        else if(x%4==1||x%4==3)count13++;
        else count0++;
    }
    if(count2==0&&count0>=count13-1)cout<<"Yes"<<endl;
    else if(count0>=count13)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
// 青 => 緑 => 赤
use std::io::Read;

fn rec(a: usize, b: usize, c: usize, k: usize) -> bool {
    if k == 0 {
        return a < b && b < c;
    }

    return rec(a * 2, b, c, k - 1) || rec(a, b * 2, c, k - 1) || rec(a, b, c * 2, k - 1);
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();

    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let c: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();

    if rec(a, b, c, k) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define sz size()
#define pb push_back
#define ve vector<int>
#define pii pair < int,int >
#define pll pair < ll,ll >
#define ll long long
#define Graph vector<vector < int > >
#define Fp cout << fixed <<  setprecision(9)
#define Fast  ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
const ll M = 1e5+10, N= 3070, MOD = 1e9+7, OO = 1e10;
ll m,n,k, x, y, dp[N][N], bla,c=1,cnt,ans,sum, a[N][4], ok=1 ;
string s, t;
stack <char> st;

int main()
{

    cin >> s >> t;
    n = s.sz;
    m = t.sz;
    for(int i=0; i<=n; i++)
        for(int j=0; j<=m; j++)
        {
            dp[i][j] = 0 ;
        }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            if(s[i-1] == t[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);




        }
    }

    ll mx = dp[n][m];
    for(int i=n;i>0 && mx;i--){
        for(int j=m;j>0 && mx;j--){
            if(dp[i][j] > dp[i-1][j] && dp[i][j] > dp[i][j-1] && dp[i][j] == mx){

                st.push(t[j-1]) ; char c = t[j-1] ; mx--; break;
            }
        }
    }
    while (!st.empty())
    {
        cout << st.top();
        st.pop();
    }
    return 0;
}
/*
3 8
3 3
4 5
5 6
*/


Measured memory_bytes: 73856
import java.util.*;
public class Main {
    public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
      String c = scan.next();
      if (c.equals("a")||c.equals("i")||c.equals("u")||c.equals("e")||c.equals("o")){
        System.out.println("vowel");
      }else{
        System.out.println("consonant");
      }
    }
}

Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    
    ll ans = 0;
    for(int i = 0; i < K; i++){
        if(T[i] == 'r'){
            ans += P;
        }else if(T[i] == 's'){
            ans += R;
        }else{
            ans += S;
        }
    }
    for(int i = K; i < N; i++){
        if(T[i] == T[i - K]){
            T[i] = 'K';
        }else if(T[i] == 'r'){
            ans += P;
        }else if(T[i] == 's'){
            ans += R;
        }else if(T[i] == 'p'){
            ans += S;
        }
        //cout << ans << "\n";
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

template<typename T, typename F> T find_max(F &solve, T low, T high) {
	T ok = low, ng = high;
	while (ng - ok > 1) {
		T mid = (ok + ng) / 2;
		if (solve(mid)) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	return ok;
}

int main() {
	long long n, m;
	cin >> n >> m;
	vector<long long> A(n), S(n+1, 0);
	for (int i = 0; i < n; i++) cin >> A[i];
	sort(A.begin(), A.end());
	for (int i = n-1; i >= 0; i--) {
		S[i] = S[i+1] + A[i];
	}

	function<long long(long long)> g = [&](long long x) {
		long long res = 0;
		int j = n;
		for (int i = 0; i < n; i++) {
			int z = x - A[i];
			while (j > 0 && A[j-1] >= z) j--;
			res += n - j;
		}
		return res;
	};
	function<bool(long long)> f = [&](long long x) {
		return g(x) >= m;
	};
	function<long long(long long)> sum = [&](long long x) {
		long long res = 0;
		int j = n;
		for (int i = 0; i < n; i++) {
			int z = x - A[i];
			while (j > 0 && A[j-1] >= z) j--;
			res += S[j] + A[i] * (n - j);
		}
		return res;
	};

	long long x = find_max(f, 0ll, A[n-1]+A[n-1]+1);
	long long ans = sum(x) - (g(x) - m) * x;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4304
from itertools import product

n = int(input())
s = input()

p = product([str(i) for i in range(10)], repeat=3)

ans = 0

for i, j, k in p:
    x = s.find(i)
    if x != -1:
        y = s.find(j, x+1)
        if y != -1:
            z = s.find(k, y+1)
            if z != -1:
                ans += 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pir;

int read() {
    int x = 0, f = 1; char ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    while (isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

const int Max = 100033;
int n, fa[Max], ans;
set<int> e[Max];
map<pir, int> cnt;
queue<pir> que;
int find(int x) {
    return x == fa[x] ? x : fa[x] = find(fa[x]);
}

int main() {
    n = read();
    for (int i = 1; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= 2 * n - 2; i++) {
        int x = read(), y = read();
        e[x].insert(y), e[y].insert(x);
        cnt[pir(x, y)]++, cnt[pir(y, x)]++;
        if (cnt[pir(x, y)] == 2) que.push(pir(x, y));
    }
    while (!que.empty()) {
        int x = que.front().first, y = que.front().second;
        que.pop();
        x = find(x), y = find(y);
        e[x].erase(y), e[y].erase(x);
        if (e[x].size() < e[y].size()) swap(x, y);
        fa[y] = x;
        for (set<int>::iterator i = e[y].begin(); i != e[y].end(); i++) {
            e[*i].erase(y), e[*i].insert(x), e[x].insert(*i);
            cnt[pir(y, *i)] = cnt[pir(*i, y)] = 0;
            cnt[pir(x, *i)]++, cnt[pir(*i, x)]++;
            if (cnt[pir(x, *i)] == 2) que.push(pir(x, *i));
        }
        e[y].clear();
    }
    for (int i = 1; i <= n; i++)
        if (i == find(i)) ans++;
    puts(ans == 1 ? "YES" : "NO");
    return 0;
}

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

int main() {
	auto optimize_cpp_stdio = []() {
		std::ios::sync_with_stdio(false);
		std::cout.tie(nullptr);
		std::cin.tie(nullptr);
		return 0;
	}();

	int n;
	std::cin >> n;
	std::vector<int> degree(n);
	std::vector<std::vector<int>> G(n);
	for (int i = 1, u, v; i < n; i++) {
		std::cin >> u >> v;
		G[--u].push_back(--v);
		G[v].push_back(u);
		degree[u]++;
		degree[v]++;
	}
	std::vector<int> a(n);
	for (int i = 0; i < n; i++)
		std::cin >> a[i];
	std::sort(a.begin(), a.end());
	std::queue<int> q;
	for (int i = 0; i < n; i++) {
		if (degree[i] == 1) q.push(i);
	}
	int dfn_n = 0;
	std::vector<int> dfn(n);
	for (; !q.empty(); q.pop()) {
		int u = q.front();
		dfn[u] = dfn_n++;
		for (int v : G[u]) {
			if (--degree[v] == 1)
				q.push(v);
		}
	}
	int ans = 0;
	for (int u = 0; u < n; u++)
		for (int v : G[u]) 
			ans += std::min(a[dfn[u]], a[dfn[v]]);
	std::cout << ans / 2 << "\n";
	for (int i = 0; i < n; i++)
		std::cout << a[dfn[i]] << " ";
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int k; std::cin >> k;
  constexpr int inf = 1 << 30;
  std::vector< int > dist(k, inf);
  std::deque< int > que;
  que.push_back(1);
  dist.at(1) = 1;
  while (!que.empty()) {
    auto crr = que.front(); que.pop_front();
    if (crr == 0)
      { break; }
    auto nxt0 = crr * 10 % k;
    if (dist.at(crr) < dist.at(nxt0)) {
      dist.at(nxt0) = dist.at(crr);
      que.push_front(nxt0);
    }
    auto nxt1 = (crr + 1) % k;
    if (dist.at(crr) + 1 < dist.at(nxt1)) {
      dist.at(nxt1) = dist.at(crr) + 1;
      que.push_back(nxt1);
    }
  }
  // debug(dist);
  auto ret = dist.at(0);
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 896
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
///////////////////////////////////////////////////////////

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int n,m;cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.rbegin(),a.rend());
    if(a[m-1] * (4 * m) >= sum){
        cout << "Yes" << '\n';
    }else{
        cout << "No" << '\n';
    }
    return 0;
}
/*
 *!!CHECK!! 
 * 制約をよく読め：まず最も愚直な解法を考えろ
 * intの掛け算をしてる場合：overflowは大丈夫？
 * 制約の下限・上限は大丈夫？
 * 木構造は一直線にした時TLEしない？
 * */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(i,a,n) for(i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int i,int n,vin &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    int i;
    int r;
    cin>>r;
    cout<<r*r<<endl;
return 0;
}

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

using namespace std;

const long long MOD = 1000000007;

vector<vector<long long>> arr(55, vector<long long>(55));

int n;

vector<vector<long long>> mult(vector<vector<long long>> &a, vector<vector<long long>> &b)
{
    vector<vector<long long>> ret(55, vector<long long>(55));
    for (int x = 0; x < n; x++)
        for (int y = 0; y < n; y++)
            for (int z = 0; z < n; z++)
                ret[x][z] = (ret[x][z] + a[x][y] * b[y][z]) % MOD;
    return ret;
}

int main()
{
    long long k;
    scanf("%i%lli", &n, &k);
    vector<vector<long long>> ret(55, vector<long long>(55));
    for (int x = 0; x < n; x++)
        for (int y = 0; y < n; y++)
            scanf("%lli", &arr[x][y]), ret[x][y] = arr[x][y];
    --k;
    while (k)
    {
        if (k&1)
            ret = mult(ret, arr);
        arr = mult(arr, arr);
        k>>=1;
    }
    long long ans = 0;
    for (auto &x : ret)
        for (auto &y : x)
            ans = (ans + y)%MOD;
    printf("%lli\n", ans);
}


Measured memory_bytes: 384
import math
N, D = map(int, input().split())

X = [0] * N
for n in range(N):
    X[n] = [int(_) for _ in input().split()]

count = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        distance = sum([(X[i][d] - X[j][d]) ** 2 for d in range(D)])
        tmp = math.sqrt(distance)
        if distance % tmp == 0:
            count += 1
print(count)

Measured memory_bytes: 3064
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
#show_flg=True


mo=998244353

n=I()
d=LI()
dp=[0]*(1+n)
ans=1
if d[0]!=0:
    ans=0
if d.count(0)!=1:
    ans=0
m=0

for i in d:
    dp[i]+=1
    m=max(i,m)

for i in range(m):
    pt=pow(dp[i],dp[i+1],mo)
    ans*=pt
    ans%=mo


print(ans%mo)


Measured memory_bytes: 55292
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define vec vector

int main(void)
{
    while(1) {
        string s;
        cin >> s;
        if (s == "0") break;
        vec<int> a((int)s.length());
        char p = '0';
        rep(i, (int)s.length()) a[i] = int(s[i]) - int(p);

        vec<vec<int>> dp((int)s.length() + 1, vec<int>(11, 0));
        dp[0][0] = 0;
        rep(i, (int)s.length()) {
            rep(j, 11) dp[i + 1][(j * 10 + a[i]) % 11] = dp[i][j];
            if (a[i]) dp[i + 1][a[i]]++;
        }

        int ans = 0;
        rep(i, (int)s.length()) ans += dp[i + 1][0];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 10116
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	int n,s[100] = {0};

	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	int sum = 0;
	for(int i = 0; i < n; i++)
	{
		sum += s[i];
	}

	sort(s,s+n);

	if (sum % 10 == 0)
	{
		for(int i = 0; i < n; i++)
		{
			if (s[i] % 10 != 0)
			{
				sum -= s[i];
				break;
			}
			if (i == n-1)
			{
				sum = 0;
			}
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int A, B, C;
    cin>>A>>B>>C;
    if (A == B) cout<<C<<endl;
    else if (B == C) cout<<A<<endl;
    else cout<<B<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
//printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main(){
    ll N,W;
    cin >>N >>W;
    vector<ll> weight(N);
    vector<ll> value(N);
    rep(i,N)cin >> weight[i] >> value[i];
    vector<vector<ll>> memo(N + 1,vector<ll>(W + 1));
    rep(i,N){
        rep(j,W + 1){
            if(j >= weight[i]){
                memo[i + 1][j] = max(memo[i][j],memo[i][j - weight[i]] + value[i]);
            }
            else{
                memo[i + 1][j] = memo[i][j];
            }
        }
    }
    cout << memo[N][W] << endl;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

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

    cout << n / 3 << endl;
}

Measured memory_bytes: 256
# B Frog 2

n, k = map(int, input().split())
h_list = [int(x) for x in input().split()]

dp = [float('Inf')] * n
dp[0] = 0

for i in range(n):
    for j in range(1,k+1,1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i-j] + abs(h_list[i-j]-h_list[i]))

        
print(dp[n-1])

Measured memory_bytes: 55520
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int p[110];
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<b;i++){
		int t;scanf("%d",&t);
		p[t]=1;
	}
	int ret=mod;
	int tmp=0;
	for(int i=c;i>0;i--){tmp+=p[i];}
	ret=min(ret,tmp);
	tmp=0;
	for(int i=c;i<a;i++)tmp+=p[i];
	ret=min(ret,tmp);
	printf("%d\n",ret);
}

Measured memory_bytes: 128
n=int(input())
cards=input().split()
cards2=cards[:]
flag=1
while flag:
  flag=0
  for i in range(n-1,0,-1):
    if cards[i][1] < cards[i-1][1]:
      cards[i], cards[i-1]=cards[i-1],cards[i]
      flag=1
print(" ".join(cards))
print("Stable")

for i in range(n):
  minj = i
  for j in range(i,n):
    if cards2[j][1] < cards2[minj][1]:
      minj = j
  if i != minj:
    cards2[i], cards2[minj]=cards2[minj],cards2[i]
print(" ".join(cards2))
if cards == cards2:
  print("Stable")
else:
  print("Not stable")


Measured memory_bytes: 5600
import sys
s = list(input())
x = []
y = []
for i in range(len(s)):
    if s[i] == "L" or s[i] == "R":
        if i%2 != 0:
            y.append(s[i])
        else:
            x.append(s[i])
if x.count("R") != len(x):
    print("No")
    sys.exit()
if y.count("L") != len(y):
    print("No")
    sys.exit()
print("Yes")

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

#define ll long long int

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast_io std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;
#define trace3(x,y,z) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;
#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(),(v).end()

using namespace std;
///////////////////////////////////////////////////////

string s;
map<char,ll> M;

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

	int n = s.size();
	REP(i,n){
		M[s[i]]++;
	}

	ll ans = (1LL*n*(n-1))/2;

	for(auto p:M){
		ans -= (1LL*p.S*(p.S-1))/2;
	}

	ans += 1;

	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
// long long -> lint
using lint = long long;
// fast cin and cout from hitonanode-san's code
// w/o 71 ms -> w/ 18 ms (tested on ABC148-D with C++14(GCC 5.4.1))
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;


int main(){
    // input
    char c;
    cin >> c;

    // out
    cout << char( int(c)+1 ) << endl;
} 

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
   
  public static void main(String[] args)
  {
     
   Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int totalWt=s.nextInt();
    int wt[]=new int[n];
   long profit[]=new long[n];
    
    for(int i=0;i<n;i++ )
    {
    	wt[i]=s.nextInt();
    	profit[i]=s.nextLong();
    }
    
    long dp[][]=new long[n][totalWt+1];
    for(int i=0;i<n;i++)
    {
    	dp[i][0]=0;
    }
    for(int i=wt[0];i<=totalWt;i++)
    {
    	dp[0][i]=profit[0];
    }
    for(int i=1;i<n;i++)
    {
    	for(int j=0;j<=totalWt;j++)
    	{
           		if(j-wt[i]>=0)
           		{
           			dp[i][j]=Math.max(profit[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
           		}
           		else
           			dp[i][j]=dp[i-1][j];
    	}
    }
    
    
   
    System.out.println(dp[n-1][totalWt]);
    
    s.close();
    
  }
}

Measured memory_bytes: 127440
#include <iostream>
using namespace std;
int main () {

int a,b;
cin>>a>>b;
if (a%3==0) {cout<<"Possible";}
else if (b%3==0) {cout<<"Possible";}
else if ((a+b)%3==0) {cout<<"Possible";}
else {cout<<"Impossible";}

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//*******************
// Mahmoud Magdy    *
//*******************
#define ll long long
#define endl "\n"

void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m ;
    cin>>m;
    return m ;
}
int main()
{
int n=D();
int x=n%10;
n=n/10;
if(n==9||x==9)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]){
    int n, m;
    cin >> n >> m;
    
    vector<int> v(m);
    int k, a;
    for (int i = 0; i < n; i++) {
        cin >> k;
        for (int j = 0; j < k; j++) {
            cin >> a;
            v[a-1]++;
        }
    }
    
    int cnt = 0;
    for (int i = 0; i < m; i++) {
        if (v[i] == n) {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 200000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;

int main() {
    string s;
    cin >> s;
    int len = s.length()-2;
    cout << s[0] << len << s[len+1] << endl;

    return 0;
}




Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Remoting.Contexts;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;

namespace Contest
{
    class Program
    {
        private Scanner sc;

        public void Solve()
        {
            sc = new Scanner();
            int K = sc.NextInt();
            int S = sc.NextInt();
            int ans = 0;
            for (int x = 0; x <= K; x++)
            {
                for (int y = 0; y <= K; y++)
                {
                    int z = S - (x + y);
                    if (0 <= z && z <= K)
                    {
                        ans++;
                    }
                }
            }
            Console.WriteLine(ans);
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 11092