akhauriyash/Code-Regression huggingface dataset:
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//229
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(b/a,c);
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3616
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define Rep(i, n) for (int i = int(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { lint to, cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3e18;

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

lint modpow(lint x, lint n) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

lint gcd(lint a, lint b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2LL; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1LL;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }


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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        int x = in.nextInt();
        int L[] = new int[n];
        int ans=0,cnt=1;
        for(int i=0;i<n;i++){
            ans+=in.nextInt();
            if(ans<=x) cnt++;
        }
        out.println(cnt);
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 23252
#include <stdio.h>
 
#define MAX (1000000)
 
char prime[MAX + 1];
 
int main(void)
{
    int n, i, j, num;
     
    prime[0] = prime[1] = 0;
    for (i = 2; i <= MAX; i++){
        prime[i] = 1;
    }
     
    for (i = 2; i * i <= MAX; i++){
        for (j = i * i; j <= MAX; j += i){
            prime[j] = 0;
        }
    }
     
    while (scanf("%d", &n), n != 0){
        i = 1;
        j = n - 1;
        num = 0;
         
        while (i <= j){
            if (prime[i] == 1 && prime[j] == 1 && n == i + j){
                num++;
                i++;
                j--;
            }
            else if (n < i + j){
                j--;
            }
            else {
                i++;
            }
        }
         
        printf("%d\n", num);
    }
     
    return (0);
}

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

int main(){
      int n;cin >> n;
      int d;cin >> d;
      int arr[n + 10][d + 10];
      int ans = 0;
      for(int i = 0;i < n;i++){
            for(int j = 0;j < d;j++){
                  cin >> arr[i][j];
            }
      }
      for(int i = 0;i < n - 1;i++){
            for(int j = i + 1;j < n;j++){
                  int sum = 0;
                  for(int k = 0;k < d;k++){
                        sum += pow(arr[i][k] - arr[j][k], 2);
                  }
                  if(floor(sqrt(sum)) == ceil(sqrt(sum)))ans++;
            }
      }
      cout << ans;
}

Measured memory_bytes: 256
inputs = input().split()
H = int(inputs[0])
W = int(inputs[1])

grid = []

grid.append('.'*W+'..')
for i in range(H):
    inputs = input().strip()
    inputs = '.' + inputs + '.'
    grid.append(inputs)
grid.append('.'*W+'..')


dx = [1,1,1,0,-1,-1,-1,0]
dy = [1,0,-1,-1,-1,0,1,1]

ans = [[0 for x in range(W)] for y in range(H)]

for row in range(len(grid)-2):
    for col in range(W):
        if grid[row+1][col+1] == '#':
            ans[row][col] = '#'
        for i in range(8):
            if grid[row+1 + dy[i]][col+1 + dx[i]] == '#':
                if ans[row][col] != '#':
                    ans[row][col] += 1

for row in ans:
    print(''.join(map(lambda x: str(x), row)))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
int main() {
	std::string s;
	std::cin >> s;

	for (auto&e : s) {
		if (e == '1'){
			e = '9';
		}else{
			if (e == '9'){
				e = '1';
			}
		}
	}

	std::cout << s << "\n";
	return 0;
}

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

int main ()
{
  int n, i, sum[1000];
  char ch[1000];

  //in
    
  while(1)
  {
    for(i = 0; i < 1000; i++)
    {
      ch[i] = '\n';
      sum[i] = 0;
    }
    
    n = 0;
      
    while(1)
    { 
      scanf("%c", &ch[n]);
      if(ch[0] == '0') break;
      if(ch[n] == '\n') break;
        
      if('1' <= ch[n] && ch[n] <= '9')
      {
        sum[n] = ch[n] - 48;
      }
      n++;
    }
      
  //calculate
      
    if(ch[0] == '0') break;
      
    for(i = 1; i < n; i++)
    {
      sum[0] += sum[i];
    }
  
  //out
      
    if(sum[0] == 0) break;
      
    printf("%d\n", sum[0]);
  }
  
  return 0;
}


Measured memory_bytes: 3160
s=input()
a=s[0]
b=s[1]
c=s[2]
d=s[3]
if a==b and c==d and a!=c:
  print("Yes")
elif a==c and b==d and a!=b:
  print("Yes")
elif a==d and b==c and a!=b:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;

struct UnionFind{
	vector<int> par;//xの親はpar[x].x自身が親ならpar[x]<0で、-par[x]がその集合のサイズ.
	
	UnionFind(int n):par(n,-1){}//コンストラクタ.
	
	void reset(int n){par.assign(n,-1);}
	int root(int x){return par[x]<0?x:par[x]=root(par[x]);}//再帰.
	int size(int x){return -par[root(x)];}
	bool same(int x,int y){return root(x)==root(y);}
	bool unite(int x,int y){
		x=root(x);
		y=root(y);
		if(x==y) return false;//do nothing.
		if(size(x)<size(y)) swap(x,y);//大きい集合に結合.
		par[x]+=par[y];
		par[y]=x;
		return true;
	}
};

int main(){
	int n,m;
	cin>>n>>m;
	
	vi a(m),b(m);
	REP(i,m){
		cin>>a[i]>>b[i];
		a[i]--;
		b[i]--;
	}
	
	int ans=0;
	REP(i,m){
		UnionFind uf(n);
		REP(j,m){
			if(i==j) continue;
			uf.unite(a[j],b[j]);
		}
		int rt=uf.root(0);
		for(int k=1;k<n;++k){
			if(uf.root(k)!=rt){
				ans++;
				break;
			}
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N, A = map(int, input().split())
    x = [int(i) for i in input().split()]

    # 3d DP
    max_x = max(x)

    dp = [[[0] * (max_x * N + 1) for j in range(N + 1)]
                                 for i in range(N + 1)]

    dp[0][0][0] = 1

    for i in range(0, N):
        for k in range(0, N + 1):
            for y in range(max_x * N + 1):
                if dp[i][k][y]:
                    dp[i + 1][k][y] += dp[i][k][y]
                    dp[i + 1][k + 1][y + x[i]] += dp[i][k][y]

            # print(dp[i][k])
        # print()

    cnt = 0
    for k in range(1, N + 1):
        for y in range(1, max_x * N + 1):
            if y // k == A and y % k == 0:
                cnt += dp[N][k][y]

    print(cnt)

if __name__ == '__main__':
    solve()

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

using namespace std;
int n,h[100001],d[100001],i,k,j,minim;
int main()
{
    cin>>n>>k;

    for(i=1;i<=n;i++)
    {
        cin>>h[i];
    }
     d[1]=0;
     for(i=2;i<=min(k,n);i++)
     {  minim=INT_MAX/2;
        for(j=1;j<i;j++)
        {
            minim=min(minim,d[j]+abs(h[i]-h[j]));
        }
        d[i]=minim;
     }

     for(i=min(k,n)+1;i<=n;i++)
     {   minim=INT_MAX/2;
         for(j=i-1;j>=i-k;j--)
         {
             minim=min(minim,d[j]+abs(h[i]-h[j]));
         }
          d[i]=minim;
     }
     cout<<d[n];
    return 0;
}


Measured memory_bytes: 1024
import java.io.*;

public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		Double data[] = new Double[6];
		String str;
		int result[] = new int[N];
		for(int i = 0; i < N; i++){
			str = br.readLine();
			String predata[] = str.split(" ",0);
			for(int j = 0; j < predata.length; j++){
				data[j] = Double.parseDouble(predata[j]);
			}
			double d = Math.sqrt(((data[0]-data[3])*(data[0]-data[3]))+((data[1]-data[4])*(data[1]-data[4])));
			if(d > data[2]+data[5]){
				result[i] = 0;
			} else {
				if(data[2] <= data[5]){
					if(d + data[2] < data[5]){
						result[i] = -2;
					} else {
						result[i] = 1;
					}
				}
				if(data[2] > data[5]){
					if(d + data[5] < data[2]){
						result[i] = 2;
					} else {
						result[i] = 1;	
					}
				}
			}
		}
		for(int i = 0; i < N; i++){
			System.out.println(result[i]);
		}
	}
}

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

int main(void)
{
    int n,t[50],i,ans=0;
    char s[50][101],x[101];

    scanf("%d",&n);
    for ( i = 0; i < n; i++)
    {
        scanf("%s %d",s[i],t+i);
    }
    scanf("%s",x);

    for ( i = 0; i < n; i++)
    {
        if(strcmp(x,s[i])==0) break;
    }

    i++;
    for (; i < n; i++)
    {
        ans+=t[i];
    }

    printf("%d",ans);

    return 0;
}

Measured memory_bytes: 128
N,M = map(int,input().split())

A = [0] * N
B = [0] * N

for i in range(N):
    A[i],B[i] = map(int,input().split())
    
arr = [[0]*2 for i in range(N)]
for i in range(N):
    arr[i] = [A[i],B[i]]
    
arr = sorted(arr,key=lambda x:x[0])

count = 0 #今何本買ったか
money = 0 #今何円使ったか
i = 0
while count < M:
    if (count+arr[i][1]) >= (M):
        money += arr[i][0] * (M - count)
        break
    else:
        count += arr[i][1]
        money += arr[i][0] * arr[i][1]
    i += 1

print(money)
    
    



Measured memory_bytes: 23588
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int n,m;
    cin>>n>>m;
    --n,--m;
    int a=0,b=0;
    a=(n*(n+1))/2;//for even
     
    b=(m*(m+1))/2;//for odd
     
    cout<<a+b<<endl;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <stack>
#include <cstdlib>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;
long long minn[4010][4010];
long long a[4010];
long long inf=2000000000100;
int main()
{
    memset(minn,inf,sizeof(minn));
    long long n,x;
    scanf ("%lld%lld",&n,&x);
    for (long long i=1;i<=n;i++)
    {
        scanf ("%lld",&a[i]);
        a[i+n]=a[i];
    }
    for (long long i=1;i<=2*n;i++)
    {
        long long tmin=a[i];
        for (long long j=i;j<=2*n;j++)
        {
            tmin=min(tmin,a[j]);
            minn[i][j]=tmin;
        }
    }
    long long ans=inf;
    for (long long k=0;k<n;k++)
    {
        long long tans=k*x;
        for (long long i=n+1;i<=2*n;i++)
        {
            tans+=minn[i-k][i];
        }
        ans=min(ans,tans);
    }
    printf ("%lld\n",ans);
    return 0;
}




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

int main() {

	char s[19];

	cin >> s;
	
	for (int i = 0; s[i] != '\0'; i++) {
		if (s[i] == ',') {
			s[i] = ' ';
		}
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	string s;
	cin>>s;
	int mx=0;
	for(int i=0;i<s.size();i++){
		int cnt=0;
		for(int j=i;j<s.size();j++){
			if(s[j]=='A'||s[j]=='C'||s[j]=='G'||s[j]=='T')cnt++;
			else break;
		}
		mx=max(mx,cnt);
	}
	cout<<mx<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    
    List<Integer> answer = new ArrayList<Integer>();
    boolean end = false;
    while(!end) {
      int a = scanner.nextInt();
      String op = scanner.next();
      int b = scanner.nextInt();

      switch(op) {
        case "+": answer.add(a+b);
          break;
        case "-": answer.add(a-b);
          break;
        case "*": answer.add(a*b);
          break;
        case "/": answer.add(a/b);
          break;
        case "?": end = true;
          break;
       }
    }

    for(int i = 0; i < answer.size(); ++i) {
      System.out.println(answer.get(i));
    }
   }
} 


Measured memory_bytes: 26324
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{

    class Program
    {

        const int Mod = 1000000007;

        static void Main()
        {

            var target = int.Parse(Console.ReadLine());
            var enable = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            Console.WriteLine(enable[0] % target == 0 || enable[0] / target != enable[1] / target ? "OK" : "NG");

        }


    }
}


Measured memory_bytes: 28288
//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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


int main(void) {
	
	int n;
	int a, b;
	int count = INF;
	int point = 0;

	cin >> n;

	FOR(i, 1, n - 1) {
		a = i;
		b = n - i;
		point = 0;
		while (1) {
			point += a % 10;
			a /= 10;
			if (a == 0) {
				break;
			}
		}
		while (1) {
			point += b % 10;
			b /= 10;
			if (b == 0) {
				break;
			}
		}
		//cout << i << " " << point << endl;
		if (point < count) {
			count = point;
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		int xor = sc.nextInt();
		list.add(xor);
		for (int i = 1; i < n; i++) {
			int in = sc.nextInt();
			xor = in ^ xor;
			list.add(in);
		}
		List<Integer> values = new ArrayList<>();
		for (Integer i : list) {
			values.add(xor ^ i);
		}
		System.out.println(values.stream().map(String::valueOf).collect(Collectors.joining(" ")));
	}
}


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

int main() {
    long long N, A, B;
    cin >> N >> A >> B;
    vector<long long> X(N);
    for (int i = 0; i < N; i++)
        cin >> X[i];

    long long res = 0;
    for (int i = 1; i < N; i++) {
        long long diff = X[i] - X[i - 1];
        res += min(diff * A, B);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    long long N;
    cin >> N;
    long long A[200000];
    long long max = 0, ans = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> A[i];
        if(A[i] < max)
            ans += max-A[i];
        else
        {
            max = A[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5184
#include "bits/stdc++.h"

using namespace std;

//typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

signed main(){

	int N;
	string s[3];
	cin >> N;
	cin >> s[0];
	cin >> s[1];
	cin >> s[2];
	int ans = 0;
	for (int i = 0; i < N; i++){
		set<char> a;
		for (int n = 0; n < 3; n++){
			a.insert(s[n][i]);
		}
		if (a.size() == 2)
			ans += 1;
		else if (a.size() == 3)
			ans += 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, raw_input().split())
ans = [0 for _ in xrange(n)]
for i in xrange(m):
    a, b = map(int, raw_input().split())
    ans[a-1] += 1
    ans[b-1] += 1
for i in xrange(n):
    print ans[i]


Measured memory_bytes: 2568
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
#define IO ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL), cerr.tie(NULL);
typedef long long ll;
typedef long double ld;
 
 
 
ll MOD=1e9 + 7;
ll OO=1e9 + 1;
const int N=1e5 + 10,M=20;
int dp[N][M];
int arr[N];
int LOG[N];

int n,m,k,T,ans;
int a,b,c;
int l,r,mid;

int main(){
	IO
	//freopen("in.txt","r",stdin);
	cin>>n>>m>>k;
	int val = ceil(1.0*n/m);
	cout<<1ll*val*k<<endl;
	
}

 

Measured memory_bytes: 3576
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String[] s=new String[n];
		int[] p=new int[n];
		String[] sp=new String[n];
		for(int i=0;i<n;i++){
			s[i]=sc.next();
			p[i]=sc.nextInt();
			sp[i]=s[i]+"_"+(1100-p[i])+"_"+(i+1);
		}
		
		Arrays.sort(sp);

		for(String k:sp){
			String ans=k.split("_")[2];
			System.out.println(ans);
		}

	}
}

Measured memory_bytes: 21844
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

// author:Swastik Banerjee

using namespace std;

typedef long long ll;
#define MOD 1000000007

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



  ll a, b;
  cin >> a >> b;

  string x, y;

  for (ll i = 0; i < b; i++) {
    x += a + '0';
  }

  for (ll i = 0; i < a; i++) {
    y += b + '0';
  }

  if (x < y)
    cout << x;
  else
    cout << y;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int[] h = new int[n];
        int a = 0;
        for(int i = 0; i < n; i++){
            h[i] = scan.nextInt();
            if(h[i] >= k){
                a++;
            }
        }
        System.out.println(a);
    }
}

Measured memory_bytes: 48892
import math
a=int(input())
b=[sorted(input()) for j in range(a)]
b.sort()
sum=0
c=1
for i in range(a-1):
  if b[i]==b[i+1]:
    c+=1
  else:
    sum+=c*(c-1)//2
    c=1
  if i==a-2:
    sum+=c*(c-1)//2
    
print(sum)

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

int main() {
	long long n,k;
	cin >> n >> k;
	long long arr[n],ans = 0;
	
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr+n);
	for(int i = 0; i < k; i++) {
		ans += arr[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    s, t = map(int, input().split())
    edges[n - s].append(n - t)

dp1 = [0.0]
for i in range(1, n):
    values = [dp1[s] + 1.0 for s in edges[i]]
    dp1.append(sum(values) / len(values))

ret = 10 ** 10
for j in range(1, n):
    dp2 = dp1[0:j]
    for i in range(j, n):
        if i == j and len(edges[i]) > 1:
            values = [dp1[s] + 1.0 for s in edges[i]]
            values.sort()
            dp2.append((sum(values) - values[-1]) / (len(values) - 1))
        else:
            values = [dp2[s] + 1.0 for s in edges[i]]
            dp2.append(sum(values) / len(values))
    ret = min(ret, dp2[-1])

print(ret)


Measured memory_bytes: 64344
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	int n;
	while (cin >> n, n)
	{
		int maxi, mini;
		maxi = -1, mini = 3333;
		while (n--)
		{
			int s = 0;
			rep (i, 5)
			{
				int t;
				cin >> t;
				s += t;
			}
			max_swap(maxi, s);
			min_swap(mini, s);
		}
		
		printf("%d %d\n", maxi, mini);
	}
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iK = int.Parse(sS[1]);
            List<char> lstInp = new List<char>();
            for (int i = 0; i < iN; i++)
            {
                string s2 = System.Console.ReadLine().Trim();
                lstInp.Add(s2[0]);                                                  //　1文字目のみ対象
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstInp.Sort();                                                          // 文字の昇順
            List<char> lstDis = lstInp.Distinct().ToList();                         // 文字の種類
            List<int> lstCnt = new List<int>();                                     // その文字の個数
            for (int i = 0; i < lstDis.Count; i++) { lstCnt.Add(0); }
            int iFig = 0;
            char cBak = lstInp[0];
            for (int i = 0; i < lstInp.Count; i++)                                  // 文字の個数取得
            {
                if (lstInp[i] == cBak) { lstCnt[iFig] += 1; }
                else { iFig += 1; lstCnt[iFig] += 1; }
                cBak = lstInp[i];
            }
            int iOut = 0;
            if (iK == 1) { iOut = iN; }                                             // 1問ならN回で完了
            else                                                                    // 1回も使用されない問題の存在がありえる
            {
                while (true)
                {
                    lstCnt.Sort();                                                  // 文字の個数の昇順
                    lstCnt.Reverse();                                               // 文字の個数の多い順
                    int iK2 = 0;
                    Boolean bOk = false;
                    for (int i = 0; i < lstCnt.Count; i++)
                    {
                        if (lstCnt[i] > 0) { lstCnt[i] -= 1; }                      // 1回で全部違う文字
                        else { continue; }                                          // 使用した問題なもう不使用
                        iK2 += 1;                                                   // 1回の問題数計算
                        if (iK2 == iK) { bOk = true; break; }                       // 1回の問題数クリア
                    }
                    if (bOk) { iOut += 1; }                                         // 1回の問題数クリアで加算
                    else { break; }                                                 // 1回の問題数クリアできず終了(1回も使用されない問題の存在がありえる)
                }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 28912
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int ca=0,cb=0;
  char ch;
  cin>>s;
  int l=s.length();
  for(int i=0;i<l;i++)
  {
    ch=s.at(i);
    if(ch=='A')
      ca++;
    else
      cb++;
  }
  if(ca==3||cb==3)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
class Dice:
    def __init__(self, e1, e2, e3, e4, e5, e6):
        self.eye1 = e1
        self.eye2 = e2
        self.eye3 = e3
        self.eye4 = e4
        self.eye5 = e5
        self.eye6 = e6
    
    def roll_e(self):
        tmp_eye   = self.eye3
        self.eye3 = self.eye1
        self.eye1 = self.eye4
        self.eye4 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_n(self):
        tmp_eye   = self.eye5
        self.eye5 = self.eye1
        self.eye1 = self.eye2
        self.eye2 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_s(self):
        tmp_eye   = self.eye2
        self.eye2 = self.eye1
        self.eye1 = self.eye5
        self.eye5 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_w(self):
        tmp_eye   = self.eye4
        self.eye4 = self.eye1
        self.eye1 = self.eye3
        self.eye3 = self.eye6
        self.eye6 = tmp_eye
    
    def get_eye1(self):
        return self.eye1

e1, e2, e3, e4 ,e5, e6 = map(int,input().split())
dice1 = Dice(e1, e2, e3, e4 ,e5, e6)
roll = input()
for i in range(len(roll)):
    if roll[i] == 'E':
        dice1.roll_e()
    if roll[i] == 'N':
        dice1.roll_n()
    if roll[i] == 'S':
        dice1.roll_s()
    if roll[i] == 'W':
        dice1.roll_w()
print(dice1.get_eye1())


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

#define ll long long int
#define ld long double
#define pb push_back

ll mod = 1000000007;

using namespace std;

int main()
{
	
	 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	 int n,m;
	 cin>>n>>m;
	 std::vector<int> v[m];
	 for (int i = 0; i < m; ++i)
	 {
	 	int k;
	 	cin>>k;
	 	for (int j = 0; j < k; ++j)
	 	{
	 		int t;
	 		cin>>t;
	 		v[i].push_back(t);
	 	}
	 }
	 int arrp[m];
	 for (int i = 0; i < m; ++i)
	 {
	 	cin>>arrp[i];
	 }

	 int range = (1<<n)-1;
	 int ans = 0;

	 for (int i = 0; i <= range; ++i)
	 {
	 	bool mark = true;

	 	for (int j = 0; j < m; ++j)
	 	{
	 		int count = 0;
	 		
	 		for (int k = 0; k < v[j].size(); ++k)
	 		{
	 			if(i&(1<<(v[j][k]-1)))
	 				count++;
	 		}

	 		if(count%2 != arrp[j])
	 		{
	 			mark = false;
	 			break;
	 		}
	 	}

	 	if(mark)
	 	{	
	 		//cout<<i<<"\n";
	 		ans++;
	 	}

	 }
	 cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L=sc.nextInt(),A=sc.nextInt(),B=sc.nextInt(),C=sc.nextInt(),D=sc.nextInt();
		if(A%C==0){
			if(B%D==0){
				if(A/C<B/D){
					System.out.println(L-B/D);
				}else{
					System.out.println(L-A/C);
				}
			}else{
				if(A/C<B/D+1){
					System.out.println(L-(B/D+1));
				}else{
					System.out.println(L-A/C);
				}
			}
		}else{
			if(B%D==0){
				if(A/C+1<B/D){
					System.out.println(L-B/D);
				}else{
					System.out.println(L-A/C+1);
				}
			}else{
				if(A/C+1<B/D+1){
					System.out.println(L-(B/D+1));
				}else{
					System.out.println(L-(A/C+1));
				}
			}
		}
		// TODO Auto-generated method stub

	}

}

Measured memory_bytes: 17360
#include<bits/stdc++.h>
#define N 10005
#define M 105
using namespace std;
int n,m,sum[N];
string s[M];

int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++)
    cin>>s[i];
  int W=0;
  for(int i=0;i<n;i++){
    int cnt=0;
    for(int j=0;j<m;j++)
      if(s[j][i]=='W')cnt++,W++;
    sum[i]=cnt;
  }
  for(int i=1;i<n;i++)
    sum[i]+=sum[i-1];
  int ans=W;
  for(int i=0;i<n;i++)
    ans=min(ans,W-sum[i]+m*(i+1)-sum[i]);
  if(ans==W)cout<<0<<' '<<1<<endl;
  else{
    for(int i=0;i<n;i++)
      if(ans==W-sum[i]+m*(i+1)-sum[i]){
	cout<<i+1<<' '<<i+2<<endl;
	break;
      }
  }
  return 0;
}

Measured memory_bytes: 4664
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' '); //700 600 680
        var a = int.Parse(str[0]); //700
        var b = int.Parse(str[1]); //600
        var c = int.Parse(str[2]); //780
        if (a < b)
        {
            if (b < c)
            {
                Console.Write(a + b);
            }
            else
            {
                Console.Write(a + c);
            }
        }
        else
        {
            if (a < c)
            {
                Console.Write(b + a);
            }
            else
            {
                Console.Write(b + c);
            }
        }
    }
}

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

#define      pai              acos(-1)
#define      ff               first
#define      ss               second
#define      ll               long long
#define      pb               push_back
#define      mp               make_pair
#define      pll              pair<ll,ll>
#define      sz(a)            (ll)a.size()
#define      endl             "\n"
#define      gcd(a, b)        __gcd(a, b)
#define      lcm(a, b)        ((a)*((b)/gcd(a,b))
#define      all(vec)         vec.begin(),vec.end()
#define      ms(a, b)         memset(a,b,sizeof(a))
#define      TEST_CASE(t)     for(int zz=1;zz<=t;zz++)
#define      PRINT_CASE       printf("Case %d: ",zz)
#define      fii              freopen("input.txt","r",stdin);
#define      foo              freopen("output.txt","w",stdout);
#define      FAST             ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const ll M   = 1e9+7;
const ll mxn = 3e5+10;
vector<pll>row(mxn),col(mxn);
set<pll>st;
int  main()
{
    ll i,j,k,a,b,c,d,n,m,t,h,u,v,w,x,y,z;
    cin>>x>>y>>n;

    for(i=1;i<=n;i++)
    {
        cin>>u>>v;
        st.insert({u,v});
        row[u].ff+=1;
        row[u].ss=u;
        col[v].ff+=1;
        col[v].ss=v;
    }
    ll mxr=0,mxc=0;
    for(auto a:row)
    {
        mxr=max(mxr,a.ff);
    }
    for(auto a:col)
    {
        mxc=max(mxc,a.ff);
    }
    set<ll>stw,sth;
    for(auto a:row)
    {
        if(a.ff==mxr)
        {
            stw.insert(a.ss);
        }
    }
    for(auto a:col)
    {
        if(a.ff==mxc)
        {
            sth.insert(a.ss);
        }
    }
    for(auto a:stw)
    {
        for(auto b:sth)
        {
            if(st.find({a,b})==st.end())
            {
                cout<<mxr+mxc<<endl;
                return 0;
            }
        }
    }
    cout<<mxr+mxc-1<<endl;
    return 0;
}


Measured memory_bytes: 59468
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
#include<cmath>
#include<set>
#include<utility>

using namespace std;


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int w = a + b + c;
	int v = w;
	for (;;)
	{
		int x = w / 3;
		if (w % 3 ==0&&x>=a&&x>=b&&x>=c)
		{
			
			cout << (x*3-(a+b+c)) / 2 << endl;
			return 0;
		}
		w += 2;
	}

}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int a[];
		a = new int[7];
		
		int q, r;
		
		int m, n;
				
		for(int i = 1; i < 7; i++){
			
			n = scan.nextInt();
			a[i] = n;
		}
		
		m = scan.nextInt();
		
		for(int i = 0; i < m; i++){
			q = scan.nextInt();
			r = scan.nextInt();
			
			if((q == a[1] && r == a[2]) ||
			   (q == a[2] && r == a[6]) ||
			   (q == a[6] && r == a[5]) ||
			   (q == a[5] && r == a[1])){
				System.out.println(a[3]);
			}else
			if((q == a[2] && r == a[3]) ||
			   (q == a[3] && r == a[5]) ||
			   (q == a[5] && r == a[4]) ||
			   (q == a[4] && r == a[2])){
				System.out.println(a[1]);
			}else
			if((q == a[1] && r == a[4]) ||
			   (q == a[4] && r == a[6]) ||
			   (q == a[6] && r == a[3]) ||
			   (q == a[3] && r == a[1])){
				System.out.println(a[2]);
			}else
			if((q == a[1] && r == a[5]) ||
			   (q == a[5] && r == a[6]) ||
			   (q == a[6] && r == a[2]) ||
			   (q == a[2] && r == a[1])){
				System.out.println(a[4]);
			}else
			if((q == a[1] && r == a[3]) ||
			   (q == a[3] && r == a[6]) ||
			   (q == a[6] && r == a[4]) ||
			   (q == a[4] && r == a[1])){
				System.out.println(a[5]);
			}else
			if((q == a[4] && r == a[5]) ||
			   (q == a[5] && r == a[3]) ||
			   (q == a[3] && r == a[2]) ||
			   (q == a[2] && r == a[4])){
				System.out.println(a[6]);
						}
		}
	}
}

Measured memory_bytes: 26212
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int [][] a=new int [n][3];
		int [][] ans=new int [n][3];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<3;j++)
			{
				a[i][j]=in.nextInt();
			}
		}
		ans[0][0]=a[0][0];
		ans[0][1]=a[0][1];
		ans[0][2]=a[0][2];
		for(int i=1;i<n;i++)
		{
			ans[i][0]=a[i][0]+Math.max(ans[i-1][1],ans[i-1][2]);
			ans[i][1]=a[i][1]+Math.max(ans[i-1][0],ans[i-1][2]);
			ans[i][2]=a[i][2]+Math.max(ans[i-1][1],ans[i-1][0]);
		}
		int ans1=Math.max(ans[n-1][0],Math.max(ans[n-1][1],ans[n-1][2]));
		System.out.println(ans1);
	}
}

Measured memory_bytes: 101416
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1000000000;

int main() {
  //
  string s;
  cin >> s;
  vl prev(26, -1);
  rep(i, s.size()) {
    int idx = s[i] - 'a';
    if (prev[idx] < 0) {
      prev[idx] = i;
    } else if (i - prev[idx] <= 2) {
      cout << prev[idx] + 1 << " " << i + 1 << endl;
      return 0;
    } else {
      prev[idx] = i;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define INS(x) x.begin(),x.end()
    

    
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;

    cout<<ceil(1.0*n/2)<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    string a=s;
    int n=s.size();
    s.erase(s.begin());
    s.pop_back();
    cout<<a.front()<<s.size()<<a.back()<<endl;
}


Measured memory_bytes: 3632
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

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() {
    int N, M;
    cin >> N >> M;
    //vector<vector<int>> data(3, vector<int>(4));
    //初期値0
    //vector<int> data(i, 0);
    vl a(N);
    if (N == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  int a,b,c;
  cin>>a>>b>>c;
  int cnt=0;
  if(a%2==0&&a==b&&b==c){
    cout<<-1<<endl;
  }
  else{
  while(a%2==0&&b%2==0&&c%2==0){
    int x=(b+c)/2,y=(c+a)/2,z=(a+b)/2;
    a=x,b=y,c=z;
    cnt++;
  }
      cout<<cnt<<endl;
  }
}
    



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
  
public class Main {
	private static final String EOF = System.lineSeparator();
	private MyIntQueue queue = new MyIntQueue();
	private ProcessManager pm = new ProcessManager();
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder();
    	
        int[] tmp = in.readIntArray(new int[2]);
    	int n = tmp[0];
    	int q = tmp[1];
    	
    	for(int i=0; i<n; i++) {
    		queue.add(pm.addProcess(in.readStrArray(" ")));
    	}
    	
    	int totalTime = 0;
    	while(!queue.isEmpty()) {
    		int procId = queue.remove();
    		int time = pm.getTime(procId);
    		if(time <= q) {
    			//Process Finish
    			totalTime += time;
    			sb.append(pm.getName(procId)).append(" ").append(totalTime).append(EOF);
    		}else{
    			//Process Continue
    			queue.add(procId);
    			pm.setTime(procId, time - q);
    			totalTime += q;
    		}
    	}
        out.print(sb.toString());
    	out.flush();
    }
}

class ProcessManager {
	private static final int CAPACITY = 100000;
	private String[] names = new String[CAPACITY];
	private int[] times = new int[CAPACITY];
	private int ptr = 0;
	
	public int addProcess(String[] procInfo) {
		names[ptr] = procInfo[0];
		times[ptr] = Integer.parseInt(procInfo[1]);
		return ptr++;
	}
	
	public String getName(int procId) {
		return names[procId];
	}
	
	public int getTime(int procId) {
		return times[procId];
	}
	
	public void setTime(int procId, int time) {
		times[procId] = time;
	}
}

class MyIntQueue {
	private static final int CAPACITY = 100000;
	private int[] queue = new int[CAPACITY];
    private int head = 0;
    private int tail = 0;
    
    public boolean isEmpty(){return head == tail;}
    public boolean isFull(){return (head+1)%CAPACITY == tail;}
    
    public int remove() {
    	if(isEmpty()) throw new IllegalStateException();
    	int ret = queue[tail++];
    	tail %= CAPACITY;
    	return ret;
    }
   
    public int add(int value) {
    	if(isFull()) throw new IllegalStateException();
    	int ret =  queue[head++] = value;
    	head %= CAPACITY;
    	return ret;
    }
}

class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public String[] readStrArray(String delim) throws NumberFormatException, IOException{
    	return br.readLine().split(delim);
    }
    
    public int readInt() throws NumberFormatException, IOException{
    	return Integer.parseInt(br.readLine());
    }
    
    public int[] readIntArray(int[] a) throws NumberFormatException, IOException{
        int i=0;
        while(i<a.length) {
            for(String s: br.readLine().split(" ")){
            	if(i<a.length) {
                    a[i++] = Integer.parseInt(s);
            	}
            }
        }
        return a;
    }
}

Measured memory_bytes: 57000
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
long long int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
//↓,→,↑,←
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 

ll i,j,k,ii,jj;
ll n,m,num,sumxor,sum;
ll ans;
ll a,b,c,d,e,f,g,h,w,v;
char s[500][500];
ll x[800005],y[800005],z[900005];
ll ma1[500005],ma2[500005];

int main(){	
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	ll start=0,end=0;
	for(start=0;start<n;start++){
		while(end < n && sum==sumxor){
			sumxor = (sumxor ^ x[end]);
			sum += x[end];
			end++;			
		}
		if(sum != sumxor){
			end--;
			sumxor = (sumxor ^ x[end]);
			sum -= x[end];			
		}
		//pe(start);p(end);
		ans += (end-start);

		sumxor = (sumxor ^ x[start]);
		sum -= x[start];
	}
	p(ans);


		
	
	return 0;
}

Measured memory_bytes: 9984