akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int n;cin>>n;
        vi h(n+1,1e10);
        inputarr(h,n);
        FORD(i,n-1,0){
            if(h[i]>h[i+1])
                h[i]--;
            if(h[i]>h[i+1]) return cout<<"No",0;
        }
        cout<<"Yes";r0

         
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
    int N,count = 0;
    int x = 0,y = 0;
    cin >> N;
    for(int i = 0;i<N;i++){
        x+=800;
        count++;
        if(count == 15){
            y+=200;
            count = 0;
        }
    }
    cout << x-y << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
inline bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h,w;cin >> h >> w;
	if(h == 1 || w == 1){
		cout << 1 << endl;
		return 0;
	}
	ll ans = (h / 2) * w;
	if(h % 2 == 1) ans += (w + 1) / 2;
	cout << ans << endl;
}


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

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

Measured memory_bytes: 3596
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    d = defaultdict(int)
    for _ in range(M):
        a, b = map(int, readline().split())
        d[a] += 1
        d[b] += 1
    for i in d.values():
        if i%2==1:
            print('NO')
            break
        else:
            continue
    else:
        print('YES')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9584
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

int main() {
	ll x; cin >> x;
	ll ans = ceil((sqrt(8 * x + 1) - 1) / 2);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

int main() {
	int n,m,h=0;

	std::cin >> n >> m;

	std::vector<int> v(m);

	std::vector<int> vv;

	for (int& x : v) {
		std::cin >> x;
	}

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

	for (int i = 0;i<m-1; i++) {
		vv.push_back(v[i + 1] - v[i]);
	}

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

	for (int i = 0; i < m - n; i++) {
		h += vv[i];
	}

	std::cout << h << std::endl;

	return 0;
}

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

int main(){

  int weight;
  int n;

  while(cin>>weight){
    vector<int> result;
    while(1){
      if(weight == 0 || weight == 1 || weight ==2 || weight ==4 || weight ==8 || weight ==16 || weight ==32 || weight ==64 || weight ==128 || weight ==256 || weight ==512){
	result.push_back(weight);
	break;
      }
      if(weight<4)
	n=2;
      else if(weight<8)
	n=4;
      else if(weight<16)
	n=8;
      else if(weight<32)
	n=16;
      else if(weight<64)
	n=32;
      else if(weight<128)
	n=64;
      else if(weight<256)
	n=128;
      else if(weight<512)
	n=256;
      else
	n=512;
      
      result.push_back(n);
      weight-=n;
    }

    sort(result.begin(),result.end());

    int flag=0;
    for(auto i:result){
      if(flag==1)
	cout<<" ";
      else flag=1;
      cout<<i;
    }
    
    cout<<endl;
    result.clear();
  }
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>

#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll)ll_MAX

typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;

const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;

using namespace std;

void solve()
{    
    ll x , k , d ;
    cin>>x>>k>>d ;
    ll dis = abs(x) ;
    ll q = dis / d ;
    if(k<=q){
        cout<<min(abs(x+k*d) , abs(x-k*d));
    }
    else{
        k -= q ;
        if(k%2){
            cout<<min(abs(x+(q+1)*d) , abs(x - (q+1)*d));
        }
        else{
            cout<<min(abs(x+q*d) , abs(x - q*d)) ;
        }
    }
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    //cout<<"helo";
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    //  cin>>t;

    while(t--)
    {
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

}

Measured memory_bytes: 3800
#include<iostream>
using namespace std;
int main () {
    int a,n,d=10000;
    cin>>a>>n;
    int b[a],c[a];
    for(int i=0;i<a;i++){
        cin>>b[i]>>c[i];
        if(c[i]<=n){
            if(b[i]<=d){
                d=b[i];
            }
        }
    }
    if(d==10000){
        cout<<"TLE"<<endl;
    }else{
        cout<<d<<endl;
    }
    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 = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());

        int[][] A = new int[n][m];
        int[][] B = new int[m][1];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                A[i][j] = Integer.parseInt(sc.next());
            }
        }

        for (int i = 0; i < m; i++) {
            B[i][0] = Integer.parseInt(sc.next());
        }

        int[][] C = new int[n][1];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                C[i][0] += A[i][j] * B[j][0];
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.println(C[i][0]);
        }
    }
}

Measured memory_bytes: 38832
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] counter = new int[4];
        int N = sc.nextInt();
        for (int i = 0; i < N ; i++) {
            String s = sc.next();
            if(s.equals("AC")){
                counter[0] = ++counter[0];
            }else if(s.equals("WA")){
                counter[1] = ++counter[1];
            }else if(s.equals("TLE")){
                counter[2] = ++counter[2];
            }else if(s.equals("RE")){
                counter[3] = ++counter[3];
            }
        }
        System.out.println("AC x " + counter[0]);
        System.out.println("WA x " + counter[1]);
        System.out.println("TLE x " + counter[2]);
        System.out.println("RE x " + counter[3]);
    }
}

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

using namespace std;

//#define FILE_IO

typedef pair<int, int> pii;

int cx[] = {-1, 1, 0, 0};
int cy[] = {0, 0, -1, 1};

int N, M, K;
char a[805][805];
int d[805][805];
queue <pii> q;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d%d\n", &N, &M, &K);
    for(int i = 1; i <= N; i++)
        scanf("%s", a[i] + 1);

    int x = 0, y = 0;
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= M; j++)
            if(a[i][j] == 'S')
            {
                x = i, y = j;
                a[i][j] = '.';
            }

    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= M; j++)
            d[i][j] = 1 << 30;

    q.push({x, y});
    d[x][y] = 0;
    while(!q.empty())
    {
        int x = q.front().first;
        int y = q.front().second;
        q.pop();

        for(int i = 0; i < 4; i++)
        {
            int nx = x + cx[i];
            int ny = y + cy[i];
            if(nx < 1 || ny < 1 || nx > N || ny > M)    continue;
            if(a[nx][ny] == '#')    continue;
            if(d[nx][ny] > d[x][y] + 1)
            {
                d[nx][ny] = d[x][y] + 1;
                q.push({nx, ny});
            }
        }
    }

    int ans = 1 << 30;
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= M; j++)
            if(d[i][j] <= K)
            {
                int dst = min( min(i - 1, j - 1), min(N - i, M - j) );
                ans = min( ans, 1 + (dst + K - 1) / K );
            }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<math.h>

int main(){
	int x,y,s,a[200]={0},i,j,max=0,cnt=0;
	while(scanf("%d,%d,%d",&x,&y,&s)!=-1){
		if(s==1){
			for(i=-1;i<2;i++) for(j=abs(i)-1;j<2-abs(i);j++) if(0<=x+j&&x+j<=9&&0<=y+i&&y+i<=9) a[(x+j)*10+(y+i)]++;
		}else if(s==2){
			for(i=-1;i<2;i++) for(j=-1;j<2;j++) if(0<=x+j&&x+j<=9&&0<=y+i&&y+i<=9) a[(x+j)*10+(y+i)]++;
		}else if(s==3){
			for(i=-2;i<3;i++) for(j=abs(i)-2;j<3-abs(i);j++) if(0<=x+j&&x+j<=9&&0<=y+i&&y+i<=9) a[(x+j)*10+(y+i)]++;
		}
	}
	for(i=0;i<=99;i++){
		if(a[i]>=max) max=a[i];
		if(a[i]==0) cnt++;
	}
	printf("%d\n%d\n",cnt,max);
	return 0;
}

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

int main() {
  int N;
  string S,T;
  cin >> N >> S >> T;
  for(int i=0; i<N; i++){
    cout << S.at(i) << T.at(i);
  }
  cout << endl;
  
}

// int型の2次元配列(3×4要素の)の宣言
  //vector<vector<int>> data(3, vector<int>(4));

  // 入力 (2重ループを用いる)
  //for (int i = 0; i < 3; i++) {
    //for (int j = 0; j < 4; j++) {
      //cin >> data.at(i).at(j);
    //}
  //}

Measured memory_bytes: 256
import numpy as np

n, K = map(int, input().split())
h = np.array(list(map(int,input().split())))

cost_dp = np.array([100000000]*n)
cost_dp[0] = 0

for i in range(1,n):
    k = min(i,K)
    cost_dp[i] = np.min(cost_dp[i-k:i]+np.absolute(h[i-k:i]-h[i]))

print(int(cost_dp[-1]))

Measured memory_bytes: 22740
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int K = sc.nextInt();

        ModLib modlib = ModLib.create(998244353);
        ModCombination modCombination = ModCombination.create(N, modlib);

        long ans = 0;
        for(int i = 0 ; i <= K ; i++){
            long ltimes = modCombination.comb(N-1, i);
            ltimes = modlib.mult(ltimes, M);
            ltimes = modlib.mult(ltimes, modlib.pow(M-1, N-i-1));
            ans = modlib.add(ans, ltimes);
        }

        System.out.println(ans);
    }
}

class ModLib {
    static public final long NO_MOD = (Long.MAX_VALUE >> 2);
    private final long mod;

    private ModLib(long mod) {
        this.mod = mod;
    }

    static public ModLib create(long mod){
        return new ModLib(mod);
    }

    static public ModLib create(){
        return new ModLib(NO_MOD);
    }

    public long add(long a, long b) {
        return (a + b) % mod;
    }

    public long sub(long a, long b) {
        return (a - b + mod) % mod;
    }

    public long mult(long a, long b) {
        return ((a % mod) * (b % mod)) % mod;
    }

    /*
        aのx乗を求める。
        O(logx)
     */
    public long pow(long a, long x) {
        long res = 1;
        while (x > 0) {
            if (x % 2 == 1) res = mult(res, a);
            a = mult(a, a);
            x >>= 1;
        }

        return res;
    }

    public long inv(long a) {
        return pow(a, mod - 2);
    }

    public long div(long a, long b) {
        return mult(a, inv(b));
    }
}

class ModCombination {
    private final ModLib modLib;

    private final long[] fact;
    private final long[] invfact;

    private ModCombination(ModLib modLib, long[] fact, long[] invfact) {
        this.modLib = modLib;
        this.fact = fact;
        this.invfact = invfact;
    }

    static public ModCombination create(int size, ModLib modLib) {
        long[] fact = new long[size];
        fact[0] = 1;
        for (int i = 0; i < size - 1; i++) {
            fact[i+1] = modLib.mult(fact[i], i + 1);
        }
        long[] invfact = new long[size];
        invfact[size-1] = modLib.div(1, fact[size-1]);
        for (int i = size - 2; i >= 0; i--) {
            invfact[i] = modLib.mult(invfact[i+1], i + 1);
        }
        return new ModCombination(modLib, fact, invfact);
    }

    public long fact(int x) {
        return fact[x];
    }

    public long invfact(int x) {
        return invfact[x];
    }

    public long comb(int a, int b) {
        if (b > a) {
            return 0;
        }
        return modLib.mult(fact[a], modLib.mult(invfact[b], invfact[a-b]));
    }
}

Measured memory_bytes: 39212
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D;
  cin >> A >>B >> C >> D;
  if((A+B) > (C+D)){
    cout << "Left" <<endl;
  }
  else if((A+B) < (C+D)){
    cout << "Right" <<endl;
  }
  else{
    cout << "Balanced" <<endl;
  }
  return 0;
}

Measured memory_bytes: 256
// V - Subtree
// https://atcoder.jp/contests/dp/tasks/dp_v
// https://www.youtube.com/watch?v=r9hbdyVkz-I
#include <bits/stdc++.h>
using namespace std;

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    sort(p.begin(),p.end());
    int ans=0;
    rep(i,k) ans+=p[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,k,n) for(int i=k;i<n;i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> iv;
typedef pair<int,int> iip;
typedef map<int,int> mii;
template <typename T>
void dbg(T t){cerr<<t<<endl ;}
template<typename T, typename... Args>
void dbg(T t, Args... args) {cerr << t <<" ";dbg(args...) ;}
string s;
// aaxabbaaa
int ispali(){
    int ans = 0;
    int i = 0,j = s.size() - 1;
    while( i < s.size()){
        if(i >= j) return ans;
        //dbg(i,j,ans);
        if(s[i] != s[j]){
            if(s[i] == 'x'){i++;ans++;}
            else if(s[j]=='x'){j--;ans++;}
            else return -1;
        }
        else{
            i++;j--;
        }
    }
    return ans;
}
int main()
{   int a,b;
    cin >> s;
    int j = 0;
    while(j <s.size() && s[j] == 'x')j++;
    a = j;
    s = s.substr(j);
    j = s.size() - 1;
    while(j>=0 && s[j] == 'x')j--;
    b = s.size() - j - 1;
    s = s.substr(0,j+1);
    if(s.size()==0) return cout<<0<<endl,0;
    int ans = ispali();
    if(ans == -1 )cout<<-1<<endl;
    else{
        cout<<ans + abs(a-b)<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}



int main(){
    int n=in();
    cout<<n*n<<endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    long long ans=0;

    for(int i=0; i<N; i++){
	cin >> d[i];
    }
    for(int i=0; i<N; i++){
	for(int j=i+1; j<N; j++){
	    ans += d[i]*d[j];
	}
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace _9_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var strList = new List<string>();
            while(true)
            {
                var s = Console.ReadLine();
                if (s == "-") break;
                var m = int.Parse(Console.ReadLine());
                for (var i = 0; i < m; i++)
                {
                    var n = int.Parse(Console.ReadLine());
                    var t1 = s.Substring(0, n);
                    var t2 = s.Substring(n, s.Length - n);
                    s = String.Concat(t2, t1);
                }
                strList.Add(s);
            }
            foreach(var ch in strList)
            {
                Console.WriteLine(ch);
            }
        }
    }
}



Measured memory_bytes: 17924
#include<iostream>
#include<string>
using namespace std;
#define MAX 105
#define ERROR "ERROR"
char G[MAX][MAX];
int px, py;

void init(){
    for ( int y = 0; y < MAX; y++ )
	for ( int x = 0; x < MAX; x++ ) G[y][x] = ' ';
    for ( int x = 0; x < MAX; x++ ) G[0][x] = 'X';
}

bool F(){
    if ( G[py][px] == ' ' ) return false;
    px++;
    return true;
}

bool B(){
    if ( G[py][px-1] == ' ' ) return false;
    px--;
    return true;
}

bool P(){
    if ( G[py+1][px] == ' '){
	char l = G[py+1][px-1];
	if ( l == ' ' ) return false;
    }
    py++;
    return true;
}

bool N(){
    if ( py == 1 ) return false;
    if ( G[py-1][px] == ' ' ){
	char l = G[py-1][px-1];
	if ( l == ' ' ) return false;
    }
    py--;
    return true;
}

bool D(){
    if ( G[py][px] == ' ' ) return false;
    G[py][px] = ' ';
    int ry = py;
    int rx = px;
    while( G[ry][rx+1] != ' '){
	G[ry][rx] = G[ry][rx+1];
	G[ry][rx+1] = ' ';
	rx++;
    }
    if ( G[py][px] == ' ' && G[py][px-1] == ' '){
	py--;
	if ( py == 0 ) return false;
	if ( G[py][px] == ' ' && G[py][px-1] == ' '){
	    return false;
	}
    }
    return true;
}

bool C(){
    if ( G[py][px] == ' ') return false;
    if ( G[py+1][px] != ' ' ) return false;
    G[py+1][px] = G[py][px];
    py++; px++;
    return true;
}

void insert(char ch){
    int wx = px;
    while(G[py][wx] != ' ') wx++;
    for ( int x = wx; x >= px+1; x--) G[py][x] = G[py][x-1];
    G[py][px++] = ch;
}

bool fall(){
    for ( int y = 2; y < MAX; y++ ){
	for ( int x = 1; x < MAX; x++ ){
	    if ( G[y][x] == ' ') continue;
	    int sx = x;
	    int ex = x;
	    while( G[y][ex+1] != ' ') ex++;
	    int ty = y;
	    bool hasc = false;
	    for ( int i = sx; i <= ex; i++ ) if ( py == y && (px == i || px == i+1)) hasc = true;
	    while(1){
		bool empty = true;
		for ( int i = sx; i <= ex; i++ ) if ( G[ty-1][i] != ' ' ) empty = false;
		if ( empty ) ty--;
		else break;
	    }
	    if ( ty < y ){
		for ( int i = sx; i <= ex; i++ ){
		    G[ty][i] = G[y][i]; G[y][i] = ' ';
		}
		if ( hasc ) py = ty;
		return true;
	    }
	    x = ex;
	}
    }
    return false;
}

string simulate(){
    string str; cin >> str;
    init();
    py = px = 1;
    G[py][px++] = str[0];
    for ( int i = 1; i < str.size(); i++ ){
	char ch = str[i];
	if ( ch == 'F' ) {
	    if ( !F() ) return ERROR;
	} else if ( ch == 'B' ){
	    if ( !B() ) return ERROR;
	} else if ( ch == 'P' ){
	    if ( !P() ) return ERROR;
	} else if ( ch == 'N' ){
	    if ( !N() ) return ERROR;
	} else if ( ch == 'D' ){
	    if ( !D() ) return ERROR;
	    while(fall());
	} else if ( ch == 'C' ){
	    if ( !C() ) return ERROR;
	} else {
	    insert(ch);
	}
    }
    string ans = "";
    int p = px-1;
    while( G[py][p] != ' '){ ans = G[py][p] + ans; p--; }
    p = px;
    while( G[py][p] != ' '){ ans = ans + G[py][p]; p++; }

    return ans;
}

main(){
    int n; cin >> n;
    for ( int i = 0; i < n; i++ ) cout << simulate() << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(void){
        
    int n;cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
        
    int inc;//増加中：１、減少中：−１、不明：０
    int ans = 1;

    //最初、増加からスタートするのか、減少からスタートするのか
    if(a[0] < a[1])inc = 1;
    else if(a[0] == a[1])inc = 0;
    else inc = -1;
        
    for(int i = 1;i < n;i++){
        if(a[i] == a[i-1])continue; //前の要素と同じならそこで区切る必要は絶対にない
        if(inc == 0){//まだ増加しているのか減少しているのか分からない状態の時、ただしこの時点でa[i] != a[i-1]
               if(a[i] > a[i-1])inc = 1;//増減が確定する
            else inc = -1;
        }else{
            if(inc == 1 and a[i] < a[i-1])ans++,inc = 0;//列をそこで区切ったら次から増加減少はまだ不明
            else if(inc == -1 and a[i] > a[i-1])ans++,inc = 0;
        }
    }
    
    cout << ans<< endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int i,j,x,y=0;
	char a[10],b[10];
	int a_i,b_i;
	scanf("%d",&x);
	while(y<x){
		a_i=0;
		b_i=0;
		scanf("%s %s",a,b);
		//printf("%s %s",a,b);
		j=0;
		while(a[j]){
			if(a[j]>'1'&&a[j]<='9'){
				switch(a[j+1]){
					case 'm':a_i+=(a[j]-'0')*1000;break;
					case 'c':a_i+=(a[j]-'0')*100 ;break;
					case 'x':a_i+=(a[j]-'0')*10  ;break;
					case 'i':a_i+=(a[j]-'0')*1   ;break;
					default:break;
				}
				j++;
			}else{
				switch(a[j]){
					case 'm':a_i+=1000;break;
					case 'c':a_i+=100 ;break;
					case 'x':a_i+=10  ;break;
					case 'i':a_i+=1   ;break;
					default:break;
				}
			}
			j++;
		}
		j=0;
		while(b[j]){
			if(b[j]>'1'&&b[j]<='9'){
				switch(b[j+1]){
					case 'm':b_i+=(b[j]-'0')*1000;break;
					case 'c':b_i+=(b[j]-'0')*100 ;break;
					case 'x':b_i+=(b[j]-'0')*10  ;break;
					case 'i':b_i+=(b[j]-'0')*1   ;break;
					default:break;
				}
				j++;
			}else{
				switch(b[j]){
					case 'm':b_i+=1000;break;
					case 'c':b_i+=100 ;break;
					case 'x':b_i+=10  ;break;
					case 'i':b_i+=1   ;break;
					default:break;
				}
			}
			j++;
		}
		//printf("\n%d %d\n",a_i,b_i);
		a_i+=b_i;
		b_i=a_i/1000;
		if(b_i>0){
			if(b_i>1){
				printf("%d",b_i);
			}
			printf("m");
		}
		b_i=a_i%1000/100;
		if(b_i>0){
			if(b_i>1){
				printf("%d",b_i);
			}
			printf("c");
		}
		b_i=a_i%100/10;
		if(b_i>0){
			if(b_i>1){
				printf("%d",b_i);
			}
			printf("x");
		}
		b_i=a_i%10;
		if(b_i>0){
			if(b_i>1){
				printf("%d",b_i);
			}
			printf("i");
		}
		printf("\n");
		
		
		y++;
	}
	return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
int main() {
	char a;
	scanf("%c",&a);
	int q;
	int w;
	int e;
	int o;
	if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
		printf("vowel");
	else
		printf("consonant");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Console.ReadLine();
            var tmp = new char[S.Length];
            var j = 0;
            for (var i = 0; i < S.Length; i++)
            {
                switch (S[i])
                {
                    case '0': tmp[j++] = '0'; break;
                    case '1': tmp[j++] = '1'; break;
                    case 'B': tmp[j > 0 ? --j : j] = '-'; break;
                }
            }

            var answer = "";
            for (var i = 0; i < tmp.Length; i++)
            {
                if (tmp[i] == '-' || tmp[i] == 0) break;
                answer += tmp[i];
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 25688
#include <stdio.h>

int main(void) {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if (a == b) {
    if (a == c)
      printf("No\n");
    else
      printf("Yes\n");
  } else if (b == c)
    printf("Yes\n");
  else if (a == c)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int par[100000];
int rank1[100000];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rank1[i] = 0;
	}
}
int find1(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find1(par[x]);
	}
}
void unite1(int x, int y) {
	x = find1(x);
	y = find1(y);
	if (x == y)return;
	if (rank1[x] < rank1[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank1[x] == rank1[y])rank1[x]++;
	}
}
bool same(int x, int y) {
	return find1(x) == find1(y);
}
struct edge { int u, v;ld cost; };
bool comp(const edge&e1, const edge&e2) {
	return e1.cost < e2.cost;
}
vector<edge> es;
int V;
ld kruskal() {
	sort(es.begin(), es.end(), comp);
	init(V);
	ld res = 0;
	for (int i = 0; i < (int)es.size(); i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite1(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}
struct point { ld x, y, z, r; };
ld dis(point a,point b) {
	ld res;
	res = sqrt(pow(a.x-b.x,2) + pow(a.y - b.y, 2) + pow(a.z - b.z, 2));
	res -= (a.r + b.r);
	if (res < 0) {
		res = 0;
	}
	return res;
}
int main() {
	while(cin>>V,V){
		es.clear();
		point p[101];
		ld x, y, z, r;
		rep(i, V) {
			cin >> x >> y >> z >> r;
			p[i] = { x,y,z,r };
		}
		rep(i, V) {
			Rep(j, i + 1, V) {
				es.push_back({ i,j,dis(p[i],p[j]) });
			}
		}
		cout << fixed << setprecision(3) << kruskal() << endl;
	}
	return 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll N;
    cin >> N;
    vec A(N);
    map<ll, ll> cnt;
    ll s = 0;
    Rep (i, N) {
        cin >> A[i];
        cnt[A[i]]++;
        s += A[i];
    }

    ll Q;
    cin >> Q;
    while (Q--) {
        ll B, C;
        cin >> B >> C;
        s -= B * cnt[B];
        s += C * cnt[B];
        cnt[C] += cnt[B];
        cnt[B] = 0;
        cout << s << "\n";
    }


}

Measured memory_bytes: 9944
/*
    BY - master_coder ( Tanu kumar )
    college - AIT
    Problem - contest ( div 3 )
*/
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
void solve(){
    string s ;
    cin >> s ;
    ans = INT_MAX ;
    for( int i = 0 ; i <= s.size()-3 ; i++){
        ll sum = (s[i] - '0')*100 +(s[i+1] - '0')*10 + (s[i+2] - '0');
        //cout << sum << " " ;
        ans = min( ans , abs(753-sum));
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void){
    int N;
    cin >> N;
    long int H[N];
    int sum_move[N], max_move;
    cin >> H[0]; sum_move[0] = 0; max_move = 0;
    for(int i=1;i<N;i++){
        cin >> H[i];
        if(H[i]<=H[i-1]){
            sum_move[i] = sum_move[i-1] + 1;
            if(max_move<sum_move[i]){
                max_move = sum_move[i];
            }
        }
        else{
            sum_move[i] = 0;
        }
    }

    cout << max_move << endl;
    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  while (cin >> n, n) {
    unsigned int sum = 0;
    vector<int> p(n), j(n - 1);
    for (auto& e : p) {
      cin >> e;
      sum += e;
    }
    for (auto& e : j) cin >> e;
    sort(j.rbegin(), j.rend());
    unsigned int ans = n * sum;
    for (int i = 0; i < n - 1; i++) {
      sum += j[i];
      ans = max(ans, (n - i - 1) * sum);
    }
    cout << ans << "\n";
  }
}


Measured memory_bytes: 3364
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

ll x;
ll y;

int main(){
  cin >> x >> y;
  ll count = 0;
  
  if(x == 1 && y == 1){
    puts("1");
    return 0;
  }
  
  if(y%2) y--;
  
  while(y >= x){
    y /= 2;
    count++;
  }
  
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  int N,K;
  cin>>N>>K;
  
  vector<int> P(N);
  for(int i=0; i<N; i++) cin>>P[i];
  
  vector<int> a(N,0);
  for(int i=1; i<N; i++) {
    if(P[i-1]<P[i]) a[i]=1;
    a[i]+=a[i-1];
  }
  
  set<int> st;
  for(int i=0; i<K; i++) st.insert(P[i]);
  
  bool cute=a[K-1]==K-1;
  int ans=!cute;
  
  for(int i=0; i<N-K;i++){
    bool ok=(*st.begin()==P[i]);
    st.erase(P[i]);
    st.insert(P[i+K]);
    //SHOW_VECTOR(st);
    ok&=(*st.rbegin()==P[i+K]);
    if(a[i+K]-a[i+1]==K-1){
      cute=true;
    }
    else if(!ok){
      ans++;
    }
  }
  
  cout<<ans+cute<<endl;
  
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a, b;
    cin >> a >> b;
    if (a < b){
        for (int i = 0; i < b; ++i) {
            cout << char(a + '0');
        }
        cout << endl;
    } else{
        for (int i = 0; i < a; ++i) {
            cout << char(b + '0');
        }
        cout << endl;
    }
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

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

  ll T;
  cin >> T;

  cout << T / A * B << endl;
}

Measured memory_bytes: 256
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A,B,M; cin >> A >> B >> M;
    vector<int> a(A),b(B),x(M),y(M),c(M);
    rep(i,A) cin >> a[i];
    rep(i,B) cin >> b[i];
    rep(i,M){
        cin >> x[i] >> y[i] >> c[i];
        x[i]--;
        y[i]--;
    }
    int min_A = 1000000, min_B = 1000000;
    rep(i,A) min_A = min(min_A, a[i]);
    rep(i,B) min_B = min(min_B, b[i]);
    int ans = min_A + min_B;
    int min_C = 1000000;
    rep(i,M) min_C = min(min_C, a[x[i]] + b[y[i]] - c[i]);
    ans = min(ans, min_C);
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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(){
  ll n;
  cin >> n;
  vector<string> s(n);
  rep(i,n){
    cin >> s[i];
  }
  sort(all(s));
  ll max = 0;
  ll count = 1;
  for (ll i = 1; i < n; i++){
    if(s[i]==s[i-1]){
      count++;
    }
    else{
      chmax(max, count);
      count = 1;
    }
    if(i==n-1){
      chmax(max, count);
    }
  }
  count = 1;
  if(max==1){
    print(s[0]);
  }
  for (ll i = 1; i < n; i++){
    if(s[i]==s[i-1]){
      count++;
    }
    else if(s[i]!=s[i-1]){
      count = 1;
    }
    if(count==max){
      print(s[i]);
    }
  }
}

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

using namespace std;

bool preceed(int x ,int y){

return x>y;
}

int main()
{
   cin.tie(0);
   cin.sync_with_stdio(0);
   int n;
   int counterO=0;
   int counterE=0;
   cin>> n;
   int arr[n];
   for(int i = 0; i<n ; i++){
    cin>> arr[i];
   }
   sort(arr,arr+n);
   reverse(arr,arr+n);

   for(int i = 0; i<n ; i++){
    if(i%2 != 0){
       counterO +=arr[i];
    }else counterE+=arr[i];
   }

   cout << counterE -counterO<<"\n" ;

}


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

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

    bool ok = true;
    rep(i,s.size()) {
        if ((i+1) % 2 == 0) {
            if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') ok = false;
        } else {
            if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D') ok = false;
        }
    }
    puts(ok?"Yes":"No");

    return 0;
}

Measured memory_bytes: 256
a=[list(map(int,input().split()))for i in range(3)]
n=int(input())
b=[int(input())for i in range(n)]
for i in range(3):
    c,d=0,0
    for j in range(3):
        if a[i][j] in b:
            c+=1
        if a[j][i] in b:
            d+=1
    if c==3 or d==3:
        print("Yes")
        break
else:
    if a[0][0]in b and a[1][1]in b and a[2][2]in b:
        print("Yes")
    elif a[0][2]in b and a[1][1]in b and a[2][0]in b:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string S;
    cin >> S;
    int ans = 0;
    for (const char c : S)
    {
        if (c == '+') ++ans;
        else --ans;
    }
    cout << ans << endl;
}


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

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

using namespace std;

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

  double sum=0;
  rep(i,n){
    double x;
    string u;
    cin>>x>>u;
    if(u=="BTC"){
      sum+=380000.0*x;
    }else{
      sum+=x;
    }
  }

  cout<<fixed<<setprecision(6)<<sum;

  return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = []
for _ in range(M):
    xyc.append(list(map(int, input().split())))

mn = [min(a) + min(b)]

for value in xyc:
    mn.append(a[value[0] - 1] + b[value[1] - 1] - value[2])

print(min(mn))


Measured memory_bytes: 42404
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int x, y;
    cin >> x >> y;
    if(y%2 == 0){
        if(2*x <= y and y <= 4*x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }else{
        cout << "No" << endl;
    } 
}

Measured memory_bytes: 3600
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
#define maxn 100010
using namespace std;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
char s[maxn];
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int n=read(),k=read();
    scanf("%s",s+1);
    int contr=0;
    rep(i,2,n) if(s[i]!=s[i-1]) contr++;
    contr=contr-2*k;
    if(contr<0) contr=0;
    printf("%d\n",n-1-contr);
	return 0;
}


Measured memory_bytes: 384
import scala.io.StdIn.readLine

object Main extends App {
  val seq1 = for(i<-1 to 9) yield List(i,i,i)
  val seq2 = for(i<-1 to 7) yield List(i,i+1,i+2)

  def check(m:List[Int], count:Int,u:Int,v:Int):Boolean =
    if(m.length != count) false
    else if(count==2) m(0)==m(1)
    else (u to 8).exists( i=> check(m diff seq1(i),count-3,i+1,v)) || (v to 6).exists(i=> check(m diff seq2(i),count-3,u,i))

  Iterator.continually(readLine).takeWhile ( _!=null ).foreach { line =>
    val l = line.map(_.asDigit).toList
    val m = (1 to 9).filter { i=> if(l.count( _==i ) >= 4) false else check(i::l,14,0,0) }
    if(m.length>0) println(m.mkString(" ")) else println(0)
  }
}

Measured memory_bytes: 67860