akhauriyash/Code-Regression huggingface dataset:
N,M,Q=map(int,input().split())
list=[[0 for i in range(N+1)]for j in range(N+1)]
for _ in range(M):
  L,R=map(int,input().split())
  list[L][R]+=1
for i in range(N):
  for j in range(N):
    list[i+1][j+1]+=(list[i+1][j]+list[i][j+1]-list[i][j])
for _ in range(Q):
  p,q=map(int,input().split())
  ans=list[q][q]-list[p-1][q]-list[q][p-1]+list[p-1][p-1]
  print(ans)

Measured memory_bytes: 13416
n = int( input() )
first = 0
second = 0
a = []
for i in range(n):
    tmp = int(input())
    if tmp >= first:
        second = first
        first = tmp
    elif tmp > second:
        second = tmp
    a.append(tmp)

for i in a:
    if i == first:
        print(second)
    else:
        print(first)
    

Measured memory_bytes: 68952
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,H,W;
    cin>>N>>H>>W;

    cout<<max((N-H+1)*(N-W+1),0LL) << endl;


}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	cout << (long long)(pow(K-1,N-1) * K) << endl;
}

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

int main() {
  int n;
  int a[210];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ret = 0;
  while (true) {
    bool cannot = false;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 != 0) {
        cannot = true;
        break;
      }
      a[i] /= 2;
    }
    if (cannot) break;
    ret++;
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
// #include <stack>
// #include <vector>
#include <cstring>
// #include <algorithm>
using namespace std;

struct Point {
    double x, y;
};

void print(Point p) {
    printf("%.8f %.8f\n", p.x, p.y);
}

void koch(int n, Point p1, Point p2) {
    if (n <= 0) {
        return;
    }
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;
    double wid = p2.x - p1.x;
    double hei = p2.y - p1.y;
    s = {(wid / 3) + p1.x, (hei / 3) + p1.y};
    t = {(wid / 3) * 2 + p1.x, (hei / 3) * 2 + p1.y};
    u = {
        (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x,
        (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y
    };
    koch(n - 1, p1, s);
    print(s);
    koch(n - 1, s, u);
    print(u);
    koch(n - 1, u, t);
    print(t);
    koch(n - 1, t, p2);
}

int main() {
    int n = 0;
    cin >> n;
    Point p1 = {0.0, 0.0};
    Point p2 = {100.0, 0.0};
    print(p1);
    koch(n, p1, p2);
    print(p2);
    
    return 0;
}


Measured memory_bytes: 3204
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    List<int>[] G;
    List<long>[] C;
    long[] cost;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        G = new List<int>[N];
        C = new List<long>[N];
        for(int i=0;i<N;i++){
            G[i] = new List<int>();
            C[i] = new List<long>();
        }
        string[] str;
        for(int i=0;i<N-1;i++){
            str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0])-1;
            int b = int.Parse(str[1])-1;
            long c = int.Parse(str[2]);
            G[a].Add(b);
            G[b].Add(a);
            C[a].Add(c);
            C[b].Add(c);
        }
        str = Console.ReadLine().Split(' ');
        int Q = int.Parse(str[0]);
        int K = int.Parse(str[1]) - 1;
        cost = new long[N];
        dfs(K,-1,0);
        for(int i=0;i<Q;i++){
            str = Console.ReadLine().Split(' ');
            long count = cost[int.Parse(str[0])-1] + cost[int.Parse(str[1])-1];
            sb.Append(count+"\n");
        }
    }
    void dfs(int v,int f,long c){
        cost[v] = c;
        for(int i=0;i<G[v].Count;i++){
            int t = G[v][i];
            if(t != f){
                dfs(t,v,c+C[v][i]);
            }
        }
    }
}

Measured memory_bytes: 52320
N = int(input())
A = list(map(int, input().split()))
DP = [[0] * (N+1) for _ in range(N+1)]

for num in range(1, N + 1):
    for start in range(N):
        end = start + num
        if end > N:
            break
        if num == 1:
            DP[start][end] = A[start]
        else:
            DP[start][end] = max(A[start] - DP[start+1][end], A[end - 1] - DP[start][end - 1])
print(DP[0][N])


Measured memory_bytes: 135316
from collections import Counter
H, W = map(int,input().split())
a = ""
for k in range(H):
    a += input()
C = Counter(a)
s = 0
for e in C:
    s += C[e]//4
if s < (H//2)*(W//2):
    print("No")
    exit(0)

a = s-(H//2)*(W//2)
t = 0
u = 0
for e in C:
    t += C[e]%4
    u += C[e]%2

if 2*t + 4*a < (H%2)*(H//2) + (W%2)*(W//2):
    print("No")
    exit(0)
if u != (H%2)*(W%2):
    print("No")
else:
    print("Yes")


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

void call(int n){
    int i = 1;
    for(int i = 1; i<=n; i++){
        int x = i;
        if ( x % 3 == 0 ){
            cout << " " << i;
            continue;
        }
        while(x){
            if ( x % 10 == 3 ){
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }

    cout << endl;
}

int main(){
    int n;
    scanf("%d", &n);
    call(n);
    return 0;
}



Measured memory_bytes: 3232
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#include <bits/stdc++.h>
#include <cmath>
#define f first
#define s second
#define ms(a, b) memset(a,b,sizeof(a))
typedef long long ll;

using namespace std;

char _;
vector<string> arr;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);

    int N,cnt=0;

    cin >> N;
    string A;
    for(int i=0;i<N;i++){
        cin >> A;
        arr.push_back(A);
    }

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

    A = "";

    for(auto s : arr){
        if(A!=s)
            cnt++;
        A=s;
    }
    cout << cnt << "\n";

    return 0;
}


Measured memory_bytes: 11576
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

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

  int r=0,b=0;
  for(int i=0;i<n;i++){
    if(s[i]=='R') r++;
    else b++;
  }
  if(r>b) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;
typedef long long int ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); i++)
#define REPEQ(i, n) FOREQ(i, 0, n)

int main()
{
  int N, M, X;
  cin >> N >> M >> X;
  int *A;
  A = new int[N + 1];
  FOR(i, 0, M)
  {
    cin >> A[i];
  }

  int costLeft = 0;
  int costRight = 0;

  FOR(i, 0, M)
  {
    if (A[i] <= X)
    {
      costLeft++;
    }
    else
    {
      costRight++;
    }
  }

  if (costLeft >= costRight)
  {
    cout << costRight << endl;
  }
  else
  {
    cout << costLeft << endl;
  }

  delete[] A;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  set<char> A;
  string S,ans="Yes";
  cin>>S;
  rep(i,0,S.size()) A.insert(S[i]);
  if((A.count('E')&&!A.count('W'))||(!A.count('E')&&A.count('W'))||(A.count('S')&&!A.count('N'))||(A.count('N')&&!A.count('S')))
    ans="No";
  cout<<ans<<endl;
  }


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

namespace ALDS1_9_C {
    class PriorityQueue<T> where T : IComparable {
        List<T> _heap;

        public PriorityQueue() {
            _heap = new List<T>();
        }
        
        public void Enqueue(T elem) {
            int n = _heap.Count;
            _heap.Add(elem);

            while (n != 0) {
                int i = (n - 1) / 2;
                if (_heap[n].CompareTo(_heap[i]) > 0) {
                    T temp = _heap[n];
                    _heap[n] = _heap[i];
                    _heap[i] = temp;
                }
                n = i;
            }
        }

        public T Dequeue() {
            T ret = _heap[0];
            PopHeap();
            return ret;
        }
        
        private void PopHeap() {
            int n = _heap.Count - 1;
            _heap[0] = _heap[n];
            _heap.RemoveAt(n);

            for (int i = 0, j; (j = 2 * i + 1) < n;) {
                if ((j != n - 1) && (_heap[j].CompareTo(_heap[j + 1]) < 0))
                    j++;
                if (_heap[i].CompareTo(_heap[j]) < 0) {
                    T tmp = _heap[j];
                    _heap[j] = _heap[i];
                    _heap[i] = tmp;
                }
                i = j;
            }
        }

        public T Peek() {
            return _heap[0];
        }

        public int Count {
            get {
                return _heap.Count;
            }
        }

        private int Compare(T x, T y) {
            return y.CompareTo(x);
        }
    }

    class Program {
        static void Main(string[] args) {
            PriorityQueue<int> pq = new PriorityQueue<int>();
            StringBuilder sb = new StringBuilder();
            bool inputEnd = false;
            while (!inputEnd) {
                string[] input = Console.ReadLine().Split(' ');
                switch (input[0]) {
                    case "insert":
                        pq.Enqueue(int.Parse(input[1]));
                        break;
                    case "extract":
                        sb.AppendLine(pq.Dequeue().ToString());
                        break;
                    case "end":
                        inputEnd = true;
                        break;
                }
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 35924
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int x;
    cin >> x;
    for(int i = x;;i++)
    {
        bool flag = true;
        for(int j = 2;j <= sqrt(x);j++)
        {
            if(i % j == 0)
            {
                flag = false;
                break;
            }
        }
        if(flag)
        {
            cout << i << "\n";
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
//b
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;

int main(){

	int n;
	int stk = 0;
	bool coresp = false;
	
	cin >> n;
	
	for(int i=0; i<n; ++i){
		
		char c;
		int t;
		
		cin >> c >> t;
		
		if(c=='('){
			stk += t;
		}
		else if(c==')'){
			if(stk-t<0)
				goto fin;
				
			stk -= t;
		}
	}
	
	if(stk==0)
		coresp = true;
	
	fin:
	cout << (coresp?"YES":"NO") << endl;
	
	return 0;	
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
    int i;
    double S;
    int count=0, answer;

    scanf("%lf", &S);

    for(i=0; i<3; i++) {
        if((S/pow(10.0, 2-i))>=1) {
            S -= pow(10.0, 2-i);
            count += 1;
        }
    }

    printf("%d \n", count);

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		
		int n1 = s.nextInt();
		int n4 = n1 % 10;
		n1 /= 10;
		int n3 = n1 % 10;
		n1 /= 10;
		int n2 = n1 % 10;
		n1 /= 10;
		
		int [][] arr = new int [][]{{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},
				{1,0,1},{1,1,0},{1,1,1}};
		
		int sum = n1;
		
		for (int i = 0; i < arr.length; i++) {
			sum = n1;
				sum = (arr[i][0]==0) ? (sum-n2) : (sum+n2);
				sum = (arr[i][1]==0) ? (sum-n3) : (sum+n3);
				sum = (arr[i][2]==0) ? (sum-n4) : (sum+n4);
				
			if(sum ==7){
				System.out.println(n1 + (arr[i][0]==0?"-":"+") + n2 +
						(arr[i][1]==0?"-":"+") + n3 +(arr[i][2]==0?"-":"+") + n4 + "=7");
				System.exit(0);
			}
		}
	}
}


Measured memory_bytes: 22996
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var N = int.Parse(Console.ReadLine());
    string s = Console.ReadLine();
    int ss = 0;
    for(int hn = 0;hn<N;hn++){
        var left = new List<char>();
        var Right = new List<char>();
        for(int i = 0;i<hn;i++){
            left.Add(s[i]);
        }
        for(int i = hn;i<N;i++){
            Right.Add(s[i]);
        }
        var hidari = left.Distinct().OrderBy(x=>x);
        var migi = Right.Distinct().OrderBy(x=>x);
        int ko = 0;
        foreach(var m in migi){
            foreach(var h in hidari){
                if(h == m) ko++;
            }
        }
        if(ko >= ss) ss = ko;
    }
    Console.WriteLine(ss);
  }
}

Measured memory_bytes: 22796
#include <iostream>
#include <algorithm>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i > (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define DEBUG_ARRAY(name, i, var) printf("the value of"#name"[%d] is %d\n", i, var)

using namespace std;

typedef long long ll;

pair<int, int> store[100005];
int N, M;

int main(void) {
    scanf("%d %d", &N, &M);

    REP(i, 0, N) {
    	int A, B;
    	scanf("%d %d", &A, &B);
    	store[i] = make_pair(A, B);
    }

    sort(store, store + N);

    ll ans = 0;
    REP(i, 0, N) {
    	ans += (ll)store[i].first * min(store[i].second, M);
    	M -= min(store[i].second, M);
    	if (M <= 0) break;
    }
    
    printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
   int n,ans;
   int *a;
   cin>>n;
   a=new int [n];
   for(int i=0;i<n;i++){
      cin>>a[i];
   }
   ans=0;
   for(int i=0;i<n;i++){
      int temp= a[i];
      while(temp%2==0){
          temp/=2;
          ans++;
      }
   }
   cout<< ans<<endl;
   return 0;
}


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

signed main(){
	string s;
	cin>>s;
	int sum=0,p=0;
	r(i,s.size()){
		if(s[i]=='B');
		else sum+=i-p,p++;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 640
/*  Author: Simanta Deb Turja 
    Website: https://simantaturja.github.io
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n;
    cin >> n;
    ll sum = 0;
    for ( int i = 1; i <= n; ++i ) {
        if ( i % 3 != 0 && i % 5 != 0 ) {
            sum += (ll)i;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main(){
    int a,b,ans=0;
    cin >> a >> b;
    if(a>b) ans += a,a --;
    else ans += b,b --;
    if(a>b) ans += a,a --;
    else ans += b,b --;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
num_masu = int(input())
masu_array = [int(x) for x in input().split()]

count = 0
for idx_masu in range(num_masu):
    if (idx_masu+1) % 2 == 1\
            and masu_array[idx_masu] % 2 == 1:
        count += 1

print(count)


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

using namespace std;

int main(void) {
    int n, m;
    int sum = 0;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int a;
        cin >> a;
        sum += a;
    }
    if(n >= sum){
        cout << n - sum << endl;
    }
    else{
        cout << "-1" << endl;
    }
    return 0;
}


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

using namespace std;
const int MOD = 1001;

int main(){
        int V, d;
        while(cin >> V >> d){
                int p1 = 1, p2 = 1;
                vector<int> fib(V);
                for(int i = 0; i < V; ++i){
                        fib[i] = (p1 + p2) % MOD;
                        p2 = p1;
                        p1 = fib[i];
                }
                sort(fib.begin(), fib.end());
                int answer = 1;
                for(int i = 1; i < V; ++i){
                        if(fib[i] - fib[i - 1] >= d){ ++answer; }
                }
                cout << answer << endl;
        }
        return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 1000

int main(void) {

//	int a=0,b=0;
//	float p=0,q=0;
	char str1[N],str2[N];



	scanf("%s %s", str1, str2);
	
	printf("%s%s", str2, str1);



	return 0;
}


Measured memory_bytes: 128
import scala.io.StdIn
import scala.collection.mutable

object Main extends App {
  val n = StdIn.readLine().toInt
  val a : Array[Int] = StdIn.readLine().split(" ").map(_.toInt)
  var ans :Array[Int] = Array.fill(n)(0)

  a.zipWithIndex.foreach { i =>
    ans(i._1 - 1) = i._2 + 1
  }

  println(ans.mkString(" "))
}


Measured memory_bytes: 49008
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int l;
vector <int> x, y, len;

inline void add(int u, int v, int w) {
  x.push_back(u);
  y.push_back(v);
  len.push_back(w);
}

int main() {
  scanf("%d", &l);
  for (int i = 1; i < 19; i ++) {
    add(i, i + 1, 0);
    add(i, i + 1, 1 << (i - 1));
  }
  int cur = 0;
  if (l >= (1 << 19)) {
    add(19, 20, 0);
    add(19, 20, 1 << 18);
    cur = 1 << 19;
  }
  for (int i = 18; ~ i; i --)
    if ((l >> i) & 1) {
      add(i + 1, 20, cur);
      cur += 1 << i;
    }
  printf("%d %d\n", 20, (int)x.size());
  for (size_t i = 0; i < x.size(); i ++)
    printf("%d %d %d\n", x[i], y[i], len[i]);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long s,n,sum;
char a;
int main(){
    cin>>s;
    for(register int i=0;i<s;++i){
        cin>>a;
        if(a=='I')
			n++;
        else
        	n--;
        sum=max(sum,n);
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N){
        ll tmp;
        cin >> tmp;
        A[i] = tmp - i-1;
    }
    ll left = -mod,right = mod;
    while(1){
        if(left == right)break;
        ll nextleft = max(left+1,(left*2+right)/3);
        ll nextright = min(right-1,(left+right*2+2)/3);
        if(nextright == nextleft)break;
        ll lefs = 0,rigs = 0;
        REP(i,N){
            lefs += abs(A[i] - nextleft);
            rigs += abs(A[i] - nextright);
        }
        if(lefs > rigs){
            left = nextleft;
        }else{
            right = nextright;
        }
    }
    ll ans = mod*10000000;
    for(ll l = left;l<=right;l++){
        ll ansk = 0;
        REP(i,N){
            ansk += abs(l - A[i]);
        }
        chmin(ans,ansk);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		System.out.println(str.charAt(0)==str.charAt(str.length()-1) ^ str.length()%2==1 ? "First" : "Second");
	}

}


Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<lint> x(n);
  for (int i = 1; i < n; ++i) {
    int a; cin >> a;
    x[i] = x[i - 1] + a;
  }
  VV<> a(m, V<>(n));
  for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[j][i];
  VV<lint> t(n + 1, V<lint>(n + 1));
  for (int j = 0; j < m; ++j) {
    V<> idx(n);
    iota(begin(idx), end(idx), 0);
    sort(begin(idx), end(idx), [&](int l, int r) { return a[j][l] > a[j][r]; });
    set<int> se{-1, n};
    for (int i : idx) {
      int l = *prev(se.lower_bound(i)) + 1;
      int r = *se.upper_bound(i);
      t[l][i] += a[j][i];
      t[l][r] -= a[j][i];
      t[i + 1][i] -= a[j][i];
      t[i + 1][r] += a[j][i];
      se.insert(i);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) t[i][j + 1] += t[i][j];
  }
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i < n; ++i) t[i + 1][j] += t[i][j];
  }
  lint res = 0;
  for (int i = 0; i < n; ++i) for (int j = i; j < n; ++j) {
    res = max(res, t[i][j] - (x[j] - x[i]));
  }
  cout << res << '\n';
}

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

//隣り合う二つを決めると残りが決まる
//mod2で考えたりxorをとる

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    rep(i,2) {
        rep(j,2) {
            vector<int> res;
            res.push_back(i);res.push_back(j);
            rep(k,N){
                if(s[k] == 'o') res.push_back(res[k] ^ res[k+1]);
                else res.push_back(res[k] ^ res[k+1] ^ 1);
            }
            if(res[N] == i && res[N+1] == j) {
                for(int l = 1; l <= N; l++){
                    cout << (res[l] ? 'W' : 'S');
                }
                cout << endl;
                return 0;
            }
        }
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 1392
#include <algorithm>
#include <cstdio>
const int MAXN = 1e4+5;
const int MAXM = 10;
const int S[MAXM] = {6,2,5,5,4,5,6,3,7,6};
int dp[MAXN][MAXM]{ };
// dp[i][j] = Max length with i matches beginning with digit j
bool yes[MAXM]{ };
int a, M, N;

int main() {
  scanf(" %d%d", &N, &M);
  for (int i = 0; i < M; ++i) {
    scanf("%d", &a);
    yes[a] = true;
  }
  yes[0] = true;
  for (int i = 0; i < N; ++i)
  for (int j = 0; j < MAXM; ++j) {
    dp[i][j] = -1;
  }
  dp[0][0] = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < MAXM; ++j) {
      if (yes[j] && (dp[i][j] >= 0)) {
        for (int k = std::max(j, 1); k < MAXM; ++k) {
          if (yes[k] && (i+S[k] <= N)) {
            dp[i+S[k]][k] = std::max(dp[i][j] + 1, dp[i+S[k]][k]);
          }
        }
      }
    }
  }
  int msd = 9;
  for (int i = MAXM-1; i >= 0; --i) {
    if (dp[N][i] > dp[N][msd]) {
      msd = i;
    }
  }
  int pos = msd;
  for (int i = N; i > 0;) {
    putchar('0' + pos);
    for (int j = MAXM-1; j >= 0; --j) if (yes[j]) {
      if (dp[i-S[pos]][j] + 1 == dp[i][pos]) {
        i -= S[pos];
        pos = j;
        break;
      }
    }
  }
  putchar('\n');
  return 0;
}


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

int main(void){
    int p,q,r;
    cin >> p >> q >> r;

    int wa, sa, seki;
    wa = p+q; sa = p+r; seki = q+r;

    if(sa>=wa && seki>=wa) cout << wa;
    else if(wa>=sa && seki>=sa) cout << sa;
    else if(wa>=seki && sa>=seki) cout << seki;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int n = N/2;
  vector<int> d(N);
  for (int i=0; i<N; i++) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  int ans = d[n] - d[n-1];
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

char out[300];
int main() {
	int N;
	cin >> N;
	char head;
	{
		cout << "?";
		for(int j=1;j<=N;j++){
			cout << " " << j;
		}
		cout << endl;
		char v[10];
		cin >> v;
		head=v[0];
	}
	int low=1,hi=N+1;
	while(low+1<hi){
		int m=(low+hi)/2;
		cout << "?";
		for(int j=0;j<N;j++){
			cout << " " << m+j;
		}
		cout << endl;
		char v[10];
		cin >> v;
		if(v[0]==head){
			low=m;
		}
		else{
			hi=m;
		}
	}
	char tail=(head=='R')?'B':'R';

	out[low]=head;
	out[low+N]=tail;
	for(int k=0;k<N-1;k++){
		cout << "?";
		for(int j=0;j<N;j++){
			if(j==k){
				cout << " " << low;
			}
			else{
				cout << " " << hi+j;
			}
		}
		cout << endl;
		char u[10];
		cin >> u;
		if(u[0]==head){
			out[hi+k]=tail;
		}
		else{
			out[hi+k]=head;
		}
		//cerr << i+k << ": " << out[k] << endl;
	}
	for(int k=1;k<=2*N;k++){
		if(out[k])continue;
		cout << "?";
		for(int j=0;j<N-1;j++){
			cout << " " << hi+j;
		}
		cout << " " << k << endl;
		char u[10];
		cin >> u;
		out[k]=u[0];
	}
	cout << "! " << (out+1) << endl;

	return 0;
}



Measured memory_bytes: 724
using System;
using System.Text.RegularExpressions;
using System.Text;
using System.Linq;


namespace aizu
{
	public class EntryPoint
	{
		public static void Main()
		{
			var line = Console.ReadLine();
			
			var v = Regex.Split(line, " ").Select(x => int.Parse(x)).ToArray();
			
			
			Console.WriteLine(string.Format("{0} {1}", v[0] * v[1], (v[0] + v[1]) * 2 ));
		}
	}


}

Measured memory_bytes: 7132
#include "bits/stdc++.h"
using namespace std;
typedef  long long ll;
const int MAXN=1e3+100;
int dig;
int solve(int idx){
    if(idx==3)
        return 1;
    int ret=0;
    for(int i=0;i<dig;i++)
        ret+=solve(idx+1);
    return ret;
}
int main(){
 cin>>dig;
 cout<<solve(0);
}

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

int main(){
  string s;
  int n,k;
  cin>>n>>k;cin>>s;
  if(s[k-1]=='A')s[k-1]='a';
  if(s[k-1]=='B')s[k-1]='b';
  if(s[k-1]=='C')s[k-1]='c';
  cout<<s<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
ball = {}

for i in a:
    if i in ball:
        ball[i] += 1
    else:
        ball[i] = 1

ball = sorted(ball.items(), key=lambda x: -x[1])

ans = 0
if len(ball) > k:
    for i in range(k):
        ans += ball[i][1]
    ans = n - ans
print(ans)


Measured memory_bytes: 98504
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<vector<int>> dist(1005, vector<int>(1005, INF));

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

    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(s[i][j] == '#')  continue;
            
            int u = w * i + j;
            for(int k = 0; k < 4; ++k){
                int nx = i + dx[k];
                int ny = j + dy[k];
                if(nx < 0 || nx >= h || ny < 0 || ny >= w)  continue;
                if(s[nx][ny] == '#')    continue;
                
                int v = w * nx + ny;
                dist[u][v] = 1;
                dist[v][u] = 1;
            }
        }
    }

    int cnt = h * w;
    for(int i = 0; i <= cnt; ++i){
        dist[i][i] = 0;
    }

    for(int k = 0; k < cnt; ++k){
        for(int i = 0; i < cnt; ++i){
            for(int j = 0; j < cnt; ++j){
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int res = 0;
    for(int i = 0; i < cnt; ++i){
        for(int j = 0; j < cnt; ++j){
            if(dist[i][j] == INF)   continue;

            chmax(res, dist[i][j]);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 4224
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	cin >> n;
	map<ll, int> mp;
	mp[0] = 1;
	ll s = 0;
	ll res = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		scanf("%d", &x);
		s += x;
		res += mp[s];
		++mp[s];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 12800
// https://atcoder.jp/contests/agc008/tasks/agc008_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll x, y;
  cin >> x >> y;

  ll res = INF;

  if (x <= y) chmin(res, y - x);
  if (-x <= y) chmin(res, y - (-x) + 1);
  if (x <= -y) chmin(res, -y - x + 1);
  if (-x <= -y) chmin(res, -y - (-x) + 2);

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
    int n;
    cin >> n;
    rep3(i, 1, 10) rep3(j, 1, 10) {
        if (i * j == n) { cout << "Yes" << endl; return 0; }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		int total;
		int sen = -1, gosen = -1, man = -1;
		boolean judge = false;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();

		for(int i = 0; i <= N; i++) {
			for(int j = 0; i+j <= N; j++) {
				total = i*1000 + j*5000 + (N-i-j)*10000;
				if(total == Y) {
					judge = true;
					sen = i;
					gosen = j;
					man = N-i-j;
				}
			if(judge) break;
			}
		if(judge) break;
		}
	System.out.println(man + " " + gosen + " " + sen);
	sc.close();
	}

}

Measured memory_bytes: 24020
#pragma GCC optimize("O3")

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int is_sum(int sum){
    int res = 0;
    while(sum > 0){
        res += sum%10;
        sum/=10;
    }
    return res;
}
signed main()
{   
    gearup;
    int n,l;cin>>n>>l;
    vector<string> s(n);
    rep(i,n)cin>>s[i];
    sort(all(s));
    rep(i,n)cout<<s[i];
    cout<<endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))
#define PI 3.141592653589793
int main()
{
    ll a;
    ll b;
    ll c;
    ll k;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> k;
    ll ans=0;
    if (a > k) {
        ans = k;
    }
    else if ((a<=k)&&(a+b>=k)) {
        ans = a;

    }
    else {
        ans = 2 * a + b - k;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
import java.util.stream.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int[] num = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};
        int n = scanner.nextInt(), m = scanner.nextInt();
        int[] a = IntStream.range(0, m).mapToObj(i -> scanner.nextInt()).sorted(Comparator.reverseOrder()).mapToInt(Integer::intValue).toArray();
        int[] dp = new int[n + 1];
        Arrays.fill(dp, 1, n + 1, -1);
        IntStream.rangeClosed(1, n)
                .forEach(i -> Arrays.stream(a)
                        .filter(j -> i >= num[j])
                        .forEach(j -> dp[i] = Math.max(dp[i], dp[i - num[j]] + 1)));
        while (n > 0) {
            for (int j : a) {
                if (n >= num[j] && dp[n - num[j]] == dp[n] - 1) {
                    System.out.print(j);
                    n -= num[j];
                    break;
                }
            }
        }

        System.out.println();
    }
}

Measured memory_bytes: 31316
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::pair<std::vector<std::pair<ll,ll>>,ll>>;

using namespace std;

int main() {
    ll N,M;
    cin >> N >> M;
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll L,R,D;
        cin >> L >> R >> D;
        L--;R--;
        G[L].first.push_back(make_pair(R,D));
        G[R].first.push_back(make_pair(L,-D));

    }
    bool visited[N];
    for (int i = 0; i < N; ++i) {
        visited[i] = false;
    }
    for (int i = 0; i < N; ++i) {
        if(visited[i]){
            continue;
        }
        queue<ll> q = queue<ll>();
        q.push(i);
        G[i].second = 0;
        visited[i] = true;
        while(!q.empty()){
            ll current = q.front();q.pop();
            for(int j = 0; j < G[current].first.size(); j++){
                pair<ll,ll> next = G[current].first[j];
                if(visited[next.first]){
                    if(G[next.first].second != G[current].second + next.second){
                        cout << "No" << endl;
                        return 0;
                    }
                    continue;
                }
                q.push(next.first);
                G[next.first].second = G[current].second + next.second;
                visited[next.first] = true;
            }
        }
    }
    cout << "Yes" << endl;


}


Measured memory_bytes: 14080
(defun f (p q)
  (+ (abs (- (car p) (car q)))
     (abs (- (cdr p) (cdr q)))))

(let* ((n (read))
       (m (read))
       (lst1 (loop repeat n
                   collect (cons (read) (read))))
       (lst2 (loop repeat m
                   collect (cons (read) (read))))
       (lst3 (loop for i in lst1
                   collect (loop for j in lst2
                                 collect (f i j)))))

  (format t "~{~A~%~}"
          (loop for i in lst3
                collect (1+ (position (apply #'min i) i)))))


Measured memory_bytes: 24520
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    set<int> res;

    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        cnt += i;
        res.emplace(i);
        if (cnt >= N) break;
    }
    if (cnt - N > 0) {
        res.erase(cnt - N);
    }
    for (auto x : res) {
        cout << x << endl;
    }
}


Measured memory_bytes: 3776
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
int a[3],i,c=0,d=0;
for(i=0;i<3;i++)
{
    cin>>a[i];
}
for(i=0;i<3;i++)
{
    if(a[i]==5)
    c++;
    else if(a[i]==7)
    d++;
}
if(c==2&&d==1)
cout<<"YES";
else
cout<<"NO";
}

Measured memory_bytes: 256
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <numeric>
#include <utility>
#include <queue>
#include <memory>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cstdlib>
#include <list>
#include <limits.h>
#include <utility>
#include <functional>
#include <iterator>
#include <deque>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second
#define F first
#define S second
#define MOD9 1000000009ll
#define MOD7 1000000007ll
#define MOD
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define SZ(x) ((int)(x).size())
#define MAXN 10010
#define MAXM
#define ALL(x) ((x).begin()),((x).end())
#define RESET(a,b) memset(a,b, sizeof a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define LEN(X) strlen(X)
#define FI(a,b,c) for(int a=b; a<c; a++)
#define FD(a,b,c) for(int a=b; a>c; a--)
using namespace std;
typedef long long ll;
typedef long long LL;
typedef double db;
typedef double D;
typedef long double ld;
typedef long double LD;
/*********default*********/
// #define ONLINE_JUDGE
string s[110];
int main()
{/*
	#ifdef ONLINE_JUDGE
    	freopen("aplusb.in", "r", stdin);
    	freopen("aplusb.out", "w", stdout);
	#endif*/
	int n, l;
	
	scanf("%d%d", &n, &l);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; i++) {
		cout << s[i];
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string n;
  cin >> n;
  int result;
  result = 0;
if (
(n=="a")||
(n=="i")||
(n=="u")||
(n=="e")||
    (n=="o")
)
{
    cout << "vowel" << endl;
}
else
{
    cout << "consonant" << endl;
}

}

Measured memory_bytes: 3556
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{
  static int n,len,mat[][],num;
	static String dig;
	static long ans;
	static StringBuilder allset;
	static long dp[][][];
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=1;
//		Integer.parseInt(br.readLine().trim());
		OutputStream outputStream =System.out;
        PrintWriter out =new PrintWriter(outputStream);
		StringBuilder printans=new StringBuilder();
		while(t-->0)
		{
			dig=br.readLine().trim();
			len=dig.length();
			num=Integer.parseInt(br.readLine());
			dp=new long[len+1][num+1][2];
			memset();
			printans.append((call(0,0,true)-1+mod)%mod);
		}
		out.println(printans);
		out.close();
		
	}
	static long call(int i,int sum,boolean edge) {
		
		if(i==len) {
			if(sum==0) {
				return 1;
			}
			return 0;
		}
		if(dp[i][sum][edge?1:0]!=-1)return dp[i][sum][edge?1:0];
		long ans =0;
		int lim=9;
		if(edge)lim=dig.charAt(i)-'0';
		
		for(int j=0;j<=lim;j++) {
			boolean temo=edge;
			if(j<lim) {
				temo=false;
			}
			ans+=call(i+1,(sum+j)%num,temo);
		}
		dp[i][sum][edge?1:0]=ans%mod;
		return ans%mod;
		
	}
	static void memset() {
		
		for(int i=0;i<dp.length;i++) {
			for(int j=0;j<dp[i].length;j++) {
				dp[i][j][0]=dp[i][j][1]=-1;
				
			}
			
		}
	}
	static int mod=(int)1e9+7;
}


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

using namespace std;

int main(void)
{
    string S, T;

    cin >> S;
    cin >> T;

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


Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 3e5+9;
const int INF = 1e9+9;
int n,MOD; 
char a[maxN];
int b[maxN];
int s[maxN];
int main()
{
	scanf("%d",&n);
	scanf("%s",a+1);
	for(int i=1;i<=n;i++)
	{
		if(a[i] == '.')
			b[i] = 0;
		else
			b[i] = 1;
	}
	s[0] = 0;
	for(int i=1;i<=n;i++)
	{
		s[i] = s[i-1] + b[i];
	}
	int ans = INF;
	for(int i=0;i<=n;i++)
	{
		int tmp = s[i] + (n-i) - (s[n] - s[i]);
		ans = min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2048
gets
d=gets.split.map(&:to_i)
testd = d[1..-1].sort.uniq
if d[0] == 0 && testd == [*1..testd.size]
  p d.group_by(&:itself).sort.map{|k,v|v.size}.each_cons(2).map{|a,b|a**b%998244353}.inject(1){|s,r|s*r%998244353}
else
  p 0
end


Measured memory_bytes: 31968
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
ll MOD = 1000000007;
ll INF = 214748364700000000;
double EPS = 1e-12;
double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
   ll X,K;
   cin >> K >> X;
   if(K * 500 >= X){
       cout << "Yes" << endl;
   }else{
       cout << "No" << endl;
   }
}

Measured memory_bytes: 256
st = input()
S = st[::-1]
words ={"remaerd","resare","maerd","esare"}

lenT = 0
flag = 0
ans = "NO"

while flag < 5:
  for i in range(5, 8):
    if S[0:i] in words:
      S = S[i:]
      flag = 0
      
    elif S == "":
      flag = 5
      ans = "YES"
      break
    else:
      flag += 1
    
print(ans)

Measured memory_bytes: 9276
#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() {
  ll n, m, d, t;
  cin >> n;
  map<int, int> mp;
  rep(i, n) {
    cin >> d;
    mp[d]++;
  }
  cin >> m;
  rep(i, m) {
    cin >> t;
    if (mp[t] != 0) {
      mp[t]--;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORd(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
#define II pair<ll,ll>

const int N=4e5+10;
const ll maxN=1e18+10;

int a[N],dp[N];

int main()
{
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n,k;
    cin >> n >> k;
    map <int,int> dd;
    FOR(i,1,k) {
        int d;
        cin >> d;
        FOR(j,1,d) {
            int h; cin >> h;
            dd[h]=1;
        }
    }
    int ans=0;
    FOR(i,1,n)
      if (dd[i]==0) ans++;
    cout << ans;
}


Measured memory_bytes: 3656