akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pii, int > a, pair < pii, int > b)//true for a before b
{
	if(a.F.F/300 < b.F.F/300)
		return 1;
	if(a.F.F/300 > b.F.F/300)
		return 0;
	if(a.F.S < b.F.S)
		return 1;
	if(a.F.S > b.F.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (3e2) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;

string s[N];
int n;

bool check(int d)
{
	int i, j;
	fo(i,0,n)
		fo(j,0,n)
			if(s[i][j] != s[(j+d)%n][(i-d+n)%n] && (j-i+n)%n != d)
				return 0;
	return 1;
}

void solve()
{
	int i, ans = 0;
	cin >> n;
	fo(i,0,n)
		cin >> s[i];
	fo(i,0,n)
		if(check(i))
			ans += n;
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> v;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans+=a;
        if(a%10!=0) v.push_back(a);
    }
    sort(v.begin(),v.end());
    if(ans%10!=0) cout<<ans<<endl;
    else if(v.size()!=0) cout<<ans-v[0]<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 3580
/* 
   AOJ 2300
   Calender Calors
*/

#include<stdio.h>
#include<math.h>
#define COLOR_N_MAX 21

struct color
{
  double l, a, b;
};

struct color colors[COLOR_N_MAX];
double dis[100000] = {0.0};
double max;


void print_com(int* com, int k)
{
  int i, j;
  double sum = 0;
  for(i = 0; i < k; i++)
    {
      for(j = i + 1; j < k; j++)
	{
	  sum += dis[com[i] * 100 + com[j]];
	  /* printf("[%d][%d]: dis = %lf\n", com[i], com[j], dis[com[i] * 100 + com[j]]); */
	}
    }
  if(max < sum)
    {
      max = sum;
    }
  /* int i; */
  /* for(i = 0; i < k; i++) */
  /*   { */
  /*     printf("%2d", com[i]); */
  /*   } */
  /* printf("\n"); */
}



void combination2(int l, int r, int k, int* com, int index)
{
  int i;
  /* printf("l = %d r = %d\n", l, r); */
  if(l > r + 1) return;
  else if(index > k) return ;
  else if(index == k)
    {
      /* for(i = 0; i < k; i++) */
      /* 	{ */

      /* 	  printf("%2d", com[i]); */
      /* 	} */
      /* printf("\n"); */
      print_com(com, k);
      return ;
    }

 
  for(i = l; i <= r; i++)
    {
      com[index] = i;
      combination2(i + 1, r, k, com, index + 1);
    }
}
void answer(int color_n, int member_n)
{
  int i, j;
  double l_dis, a_dis, b_dis;
  
  for(i = 0; i < color_n; i++)
    {
      for(j = i + 1; j < color_n; j++)
	{
	  l_dis = fabs(colors[i].l - colors[j].l);
	  a_dis = fabs(colors[i].a - colors[j].a);
	  b_dis = fabs(colors[i].b - colors[j].b);
	  dis[i * 100 + j] = l_dis * l_dis + a_dis * a_dis + b_dis * b_dis;
	}
    }
  
  int com[member_n];
  combination2(0, color_n - 1, member_n,com, 0);
}



/* combination(0, 4, 3, com, 0) */


int main(void)
{
  int i, color_n, member_n;

  scanf("%d %d", &color_n, &member_n);

  for(i = 0; i < color_n; i++)
    {
      scanf("%lf %lf %lf", &colors[i].l, &colors[i].a, &colors[i].b);
    }

  answer(color_n, member_n);

  /* combination(5); */
  /* int com[3]; */
  /* combination2(0, 4, 3, com, 0); */
  printf("%lf\n", max);

  /* printf("%lf\n", answer(color_n, member_n)); */

  return 0;
}

Measured memory_bytes: 680
n = int(input())
a = 0
if n/1.08 > n//1.08:
  a = n//1.08+1
#  print("a:{}".format(a))
else:
  a = n//1.08
#  print("a:{}".format(a))

if int(a*1.08) == n:
  print(int(a))
else:
  print(":(")

Measured memory_bytes: 3064
n = int(input())
lists = list(map(int,input().split()))



def checker(lists):
	sns = sum([a%2 for a in lists])
	#print(sns)
	if sns==0:
		lists = [a/2 for a in lists]
		return lists
	else:
		return 0

cnt = 0
while(1):
	lists=checker(lists)
	if lists != 0:
		cnt = cnt+1
	else:
		break

print(cnt)


Measured memory_bytes: 3060
N = int(input())
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0

for i in range(N):
    S = input()
    if('AC' == S):
        count_AC += 1
    elif('WA' == S):
        count_WA += 1
    elif('TLE' == S):
        count_TLE += 1
    else:
        count_RE += 1
        
print('AC x', count_AC)
print('WA x', count_WA)
print('TLE x', count_TLE)
print('RE x', count_RE)

Measured memory_bytes: 9212
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX 101
#define INF 2001
int color[MAX],d[MAX],p[MAX],G[MAX][MAX],n;
int prim(){
  int i,j,u,min,sum=0;
  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=-1;
    color[i]=WHITE;
  }
  d[0]=0;
  while(1){
    min=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(min > d[i] && color[i] != BLACK){
	u=i;
	min=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(j=0;j<n;j++){
      if(color[j] != BLACK && G[u][j] < d[j]){
	if(d[j] > G[u][j]){
	  d[j]=G[u][j];
	  p[j]=u;
	  color[j]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i] != -1){
      sum+=G[i][p[i]];
    }
  }
  return sum;
}
int main(){
  int i,j,sum;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&G[i][j]);
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(G[i][j]==-1) G[i][j]=INF;
    }
  }
  sum=prim();
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
long long b[100001];
int main(void){
	int N,Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	for(int i=0;i<N-1;i++){
		if(S[i]=='A'&&S[i+1]=='C'){
			b[i+1]++;
		}
	}
	for(int i=1;i<N;i++){
		b[i]+=b[i-1];
	}
	vector<int> l,r;
	for(int i=0;i<Q;i++){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		l.push_back(a);
		r.push_back(b);
	}
	for(int i=0;i<Q;i++){
		cout << b[r[i]] - b[max(0,l[i])] << endl;
	}
}

Measured memory_bytes: 2804
/*
 * FindingMissingCards.cpp
 *
 *  Created on: 2014/07/22
 *      Author: WanWan1985
 */
#include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;
#define CARDS_NUM	(13)
#define ARRAY_SIZE(a)	sizeof(a) / sizeof(a[0])

typedef struct {
	string strTrumpType;
	vector<int> vecCardsNum;
}TrumpTypeSet;

// 各トランプの不足枚数をカウント
TrumpTypeSet CountTheLeftCards(string a_strTrumpType, vector<map<string, int> > a_vecTrumpSet);

int main(void) {

	int iNumber = 0;
	cin >> iNumber;	// 与えられたカード枚数

	vector<map<string, int> > vecTrumpSet;
	for (int i = 0; i < iNumber; i++) {
		int iCardNumber = 0;
		string strPattern = "";
		map<string, int> mapTrumpSet;
		cin >> strPattern >> iCardNumber;
		mapTrumpSet.insert(make_pair(strPattern, iCardNumber));
		vecTrumpSet.push_back(mapTrumpSet);
	}

	string strArray[] = {"S", "H", "C", "D"};
	for (unsigned int i = 0; i < ARRAY_SIZE(strArray); i++) {
		TrumpTypeSet Trump = CountTheLeftCards(strArray[i], vecTrumpSet);
		for (unsigned int j = 0; j < Trump.vecCardsNum.size(); j++) {
			cout << strArray[i] << " " << Trump.vecCardsNum.at(j) << endl;
		}
	}

	return 0;
}

TrumpTypeSet CountTheLeftCards(string a_strTrumpType, vector<map<string, int> > a_vecTrumpSet) {

	vector<bool> vecbCardsType(CARDS_NUM, true);

	TrumpTypeSet TrumpType;
	TrumpType.strTrumpType = a_strTrumpType;
	vector<int> vecCardsNumTmp;
	for (unsigned int i = 0; i < a_vecTrumpSet.size(); i++) {
		map<string, int> mapTrumpSet = a_vecTrumpSet.at(i);
		vecCardsNumTmp.push_back(mapTrumpSet[a_strTrumpType]);
	}

	for (unsigned int i = 0; i < vecCardsNumTmp.size(); i++) {
		int iCardNum = vecCardsNumTmp.at(i);
		for (int j = 0; j < CARDS_NUM; j++) {
			if (iCardNum == j + 1) {
				vecbCardsType.at(j) = false;
			}
		}
	}

	for (unsigned int i = 0; i < vecbCardsType.size(); i++) {
		if (vecbCardsType.at(i)) {
			TrumpType.vecCardsNum.push_back(i+1);
		}
	}

	return TrumpType;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                  \
  ifstream in("atcoder-problems/sumitb2019_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  string ans;
  int tmp = N / 1.08;

  while (int(tmp * 1.08) < N) {
    tmp++;
  }
  if (int(tmp * 1.08) == N) {
    ans = to_string(tmp);
  } else {
    ans = ":(";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
n, y = map(int, input().split())

flg = False
for i in range(n + 1):
    for j in range(n + 1):
        if n - (i + j) >= 0:
            if 1000 * (n - (i + j)) + 5000 * j + 10000 * i == y:
                flg = True
                print(str(i) + ' ' + str(j) + ' ' + str(n - (i + j)))
                break
    if flg:
        break

if not flg:
    print('-1 -1 -1')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>

using namespace std;

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

int main(){
    long int n, k;
    cin >> n >> k;
    long int a[n];
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    long int c[n];
    rep(i, n) c[i] = 0;
    rep(i, n) c[a[i]]++;
    sort(c, c + n, greater<long int>());
    long int ans = 0;
    for (int i = k; i < n; i++){
        ans += c[i];
    }
    
    cout << ans << endl;
}

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

int main() {
  int K;
  cin >> K;
  string S;
  cin >> S;
  if (S.size() <= K) {
    cout << S << endl;
  }
  else {
    S.erase(K);
    cout << S + "..." << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
struct P {int x,y,z;};
typedef pair<double,int> PP;

int main() {
  int n;
  cin >> n;
  P p[n];
  PP a[n];
  for(int i=0; i<n; i++) {
    int x,y,z;
    cin >> x >> y >> z;
    p[i]=(P){x,y,z};
    a[i]=PP((double)z/x,i);
  }
  sort(a,a+n,greater<PP>());
  vector<int> ans;
  int c[400];
  memset(c,0,sizeof(c));
  for(int i=0; i<400; i++) {
    int r=i;
    for(int k=0; k<n; k++) {
      while(r>=p[a[k].second].x) {
        r-=p[a[k].second].x;
        c[i]+=p[a[k].second].z;
      }
    }
    if(r) c[i]=-1;
  }
  int m;
  cin >> m;
  while(m--) {
    int M=-1,e;
    cin >> e;
    for(int i=0; i<n; i++) {
      for(int j=p[i].x; j<=p[i].y; j++) {
        int r=e-j,d=p[i].z;
        if(r<0) continue;
        else if(c[r]!=-1) M=max(M,d+c[r]);
      }
    }
    if(M==-1) {
      cout << -1 << endl;
      return 0;
    } else ans.push_back(M);
  }
  for(int i=0; i<ans.size(); i++) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 1232
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n;
	cin>>n;
	vector<vector<int>> srt(n,vector<int>());
	vector<int> dp(n,0);
	vector<int> a(n,0);
	vector<int> in(n,0);
	FOR(i,1,n){
		cin>>a[i];
		a[i]--;
		in[a[i]]++;
	}
	queue<int> q;
	FOR(i,0,n){
		if(in[i]==0){
			q.push(i);
		}
	}
	while(q.size()){
		int nw=q.front();
		q.pop();
		int nx=a[nw];
		sort(srt[nw].rbegin(),srt[nw].rend());
		int l=srt[nw].size();
		int mx=0;
		FOR(i,0,l){
			mx=max(mx,srt[nw][i]+i+1);
		}
		dp[nw]=mx;
		//cerr<<nw<<" "<<dp[nw]<<endl;
		in[nx]--;
		srt[nx].PB(mx);
		if(in[nx]==0){
			q.push(nx);
		}
	}
	cout<<dp[0];
	return 0;
}


Measured memory_bytes: 6912
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        while (true) {
            if (isPrime(x)) {
                System.out.println(x);
                return;
            }
            x++;
        }
    }
    
    static boolean isPrime(int x) {
        for (int i = 2; i <= Math.sqrt(x); i++) {
            if (x % i == 0) {
                return false;
            }
        }
        return true;
    }
}

Measured memory_bytes: 22228
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] num = new int[5];
		
		for(int i = 0; i<5; i++){
			num[i] = keyboard.nextInt();
		}
		
		int K = keyboard.nextInt();
		
		String ans = "Yay!";
		for(int j = 0; j<4; j++){
			for(int k = 1; k<5; k++){
				if(num[k] - num[j] > K){
					ans = ":(" ;
				}
			}
		}

		System.out.println(ans);
		keyboard.close();	
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
int main(){
char a[101];
char b[101];
int i,c,x=0,y=0;
scanf("%d\n",&c);
for(i=0;i<c;i++){
scanf("%s %s\n",a,b);
if(strcmp(a,b)>0){
x=x+3;
}
else if(strcmp(a,b)==0){
x++;
y++;
}
else{
y=y+3;
}
}
printf("%d %d\n",x,y);
return 0;
}


Measured memory_bytes: 2124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	ll n,x;
	scanf("%lld %lld",&n,&x);
	ll cnt=0;
	ll crr=0;
	rep(i,0,n+1){
		if(crr<=x)cnt++;
		ll t;
		scanf("%lld",&t);
		crr+=t;
	}
	printf("%lld",cnt);
}

Measured memory_bytes: 128
import java.util.*
import java.math.*
import java.lang.Math.*


private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
//private val MOD = 1e9.toLong()+7
//private val INF = Int.MAX_VALUE/2
//private val LINF = Long.MAX_VALUE/2


class GridBfs(val G: List<String>, val Start:Char = '#',
              val ToPaint:Char = '.') {
    var H:Int = 0
    var W:Int = 0
    data class Pos(val x: Int, val y: Int)
    private val starts = ArrayList<Pos>()
    init {
        H = G.size
        W = G[0].length
        G.forEachIndexed{i, row ->
            row.forEachIndexed{j, cell ->
                if (cell == Start) starts.add(Pos(i,j))
            }
        }
    }
    private val dx = intArrayOf(0,1,0,-1)
    private val dy = intArrayOf(1,0,-1,-0)
    private val INF = Int.MAX_VALUE/2
    fun fill(): Int {
        val que = LinkedList<Pos>()
        val step = Array(H){IntArray(W){INF} }
        for (ps in starts) {
            que.addLast(ps)
            step[ps.x][ps.y] = 0
        }
        while (que.isNotEmpty()) {
            val (x, y) = que.removeFirst()
            for (i in dx.indices) {
                val nx = x + dx[i]; val ny = y + dy[i]
                if (nx<0 || H<=nx || ny<0 || W<=ny) {
                    continue
                }
                if (step[nx][ny] > step[x][y] + 1) {
                    step[nx][ny] = step[x][y] + 1
                    que.addLast(Pos(nx, ny))
                }
            }
        }

        var res = -INF
        step.forEach { it.forEach { res = max(res, it) } }
        return res
    }
}


fun solveA(A: Array<String>): Int {
    val bfs = GridBfs(A.toList())
    return bfs.fill()
}


fun main(args: Array<String>) {
    val (H, W) = readListInt()
    val A = Array<String>(H){""}
    for (i in 0 until H) {
        A[i] = readString()
    }

    val ans = solveA(A)

    println(ans)
}


Measured memory_bytes: 131500
#include <stdio.h>
#include <stdlib.h>

int cmpnum(const void * n1, const void * n2) {
	if (*(long *)n1 > *(long *)n2)
	{
		return -1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  qsort(a, n, sizeof(long), cmpnum);
  long creatures = n;
  long size = a[n-1];
  for (long i = n-1; i > 0; i--) {
    if (a[i-1] > size*2) {
      creatures = i;
    }
    size += a[i-1];
  }
  printf("%ld\n", creatures);

  return 0;
}

Measured memory_bytes: 1788
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(){
 
    char buf[201];
    fgets(buf,201,stdin);
    for(int i=0;buf[i]!='\0';i++){
        if(buf[i] >= 97 && buf[i] <=122){
            buf[i] -= 32;
        }
    }
 
    printf("%s",buf);
    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <cstdio>
using namespace std;
int main(void) {
  int s1[5], s2[5], total[5], max, shop;
  
  while(1) {
    max = 0;
    cin >> s1[0] >> s2[0];
    total[0] = s1[0] + s2[0];
    if(s1[0] == 0 && s2[0] == 0) break;
    for(int i = 1 ; i < 5 ; i++) {
      cin >> s1[i] >> s2[i];
      total[i] = s1[i] + s2[i];
    }
    
    for(int i = 0 ; i < 5 ; i++) {
      if(total[i] > max) { max = total[i]; shop = i; }
    }

    if(shop == 0) cout << 'A' << ' ' << total[0] << endl;
    if(shop == 1) cout << 'B' << ' ' << total[1] << endl;
    if(shop == 2) cout << 'C' << ' ' << total[2] << endl;
    if(shop == 3) cout << 'D' << ' ' << total[3] << endl;
    if(shop == 4) cout << 'E' << ' ' << total[4] << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
 
int main(){
  long a[2];
  long b[2];
  long max;
  int firstFlg = 0;
  
  std::cin >> a[0] >> a[1] >> b[0] >> b[1];
 
  for ( int i = 0; i < 2; i++ ){
    for ( int j = 0; j < 2; j++ ) {
      if ( firstFlg == 0 ) {
        firstFlg = 1;
        max = a[i]*b[j];
      }
      if ( max < a[i]*b[j] ) {
        max = a[i]*b[j];
      }
    }
  }
 
  std::cout << max;
  
}

Measured memory_bytes: 3628
fn main() {
  let (h, w): (usize, usize) = read_tuple();
  let mut mat: Vec<char> = read_vec();
  
  mat.sort();
  let mut freq = vec![0; 26];
  for c in mat {
    freq[c as usize - 'a' as usize] += 1;
  }
  
  let ans = match (h, w) {
    (1, 1) => true,
    _ if h==1 && w%2==0 || h%2==0 && w==1 => freq.iter().all(|n| n%2==0),
    _ if h==1 && w%2==1 || h%2==1 && w==1 => freq.iter().filter(|&n| n%2==1).count() == 1,
    _ if h%2==0 && w%2==0 =>
      freq.iter().all(|n| n%4==0),
    _ if h%2==1 && w%2==1 =>
      freq.iter().filter(|&&n| n>=4).map(|&n| n/4).sum::<usize>() >= (h/2) * (w/2) &&
      freq.iter().filter(|&n| n%2==1).count() == 1,
    _ =>
      freq.iter().filter(|&&n| n>=4).map(|&n| n/4).sum::<usize>() >= (h/2) * (w/2) &&
      freq.iter().all(|&n| n%2==0),
  };

  println!("{}", if ans {"Yes"} else {"No"});
}

fn read_tuple<T1: std::str::FromStr, T2: std::str::FromStr>() -> (T1, T2) {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  let mut it = buf.trim().split_whitespace();
  let x = it.next().unwrap().parse::<T1>().ok().unwrap();
  let y = it.next().unwrap().parse::<T2>().ok().unwrap();
  (x, y)
}

use std::io::Read;
fn read_vec() -> Vec<char> {
  let mut buf = String::new();
  std::io::stdin().read_to_string(&mut buf).ok();
  buf.trim().chars().filter(|&c| char::is_alphabetic(c)).collect()
}


Measured memory_bytes: 4352
import sys
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2:#odd
    if a[0]!=0:
        print(0)
        sys.exit()
    cur=2
    for i in range(1,n,2):
        if a[i]!=cur or a[i]!=a[i+1]:
            print(0)
            sys.exit()
        cur+=2
    ans=1
    for i in range(n//2):
        ans=(ans*2)%mod
    print(ans)
else:#even
    cur=1
    for i in range(0,n,2):
        if a[i]!=cur or a[i]!=a[i+1]:
            print(0)
            sys.exit()
        cur+=2
    ans=1
    for i in range(n//2):
        ans=(ans*2)%mod
    print(ans)



Measured memory_bytes: 14008
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==b)cout<<"Draw"<<endl;
  else {
    if(a==1)cout<<"Alice"<<endl;
    else if(b==1)cout<<"Bob"<<endl;
    else cout<<(a<b?"Bob":"Alice")<<endl;
  }
  return 0;
}


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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///

string s;
vvi dp(500, vi(500));
bool dfs(int l, int r) {
	if (l > r)return true;
	if (dp[l][r] != -1)return dp[l][r];
	if (s[l] != 'm' || s[r] != 'w')return dp[l][r] = false;
	bool ret = false;
	FOR(i, l, r + 1) {
		if (s[i] == 'e') {
			ret |= dfs(l+1, i - 1)&dfs(i + 1, r-1);
		}
	}
	return dp[l][r] = ret;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> s;
	REP(i, s.size())REP(j, s.size())dp[i][j] = -1;
	dfs(0, s.size() - 1);
	if (dp[0][s.size()-1]==1) {
		cout << "Cat" << endl;
	}
	else cout << "Rabbit" << endl;
}

Measured memory_bytes: 4208
import java.io.*;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String n = fs.next();
        if( '7' == n.charAt(0) ){
            System.out.println("Yes");
            return;
        }
        if( '7' == n.charAt(1) ){
            System.out.println("Yes");
            return;
        }
        if( '7' == n.charAt(2) ){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int bufferLength = 0;

        private boolean hasNextByte() {
            if (ptr < bufferLength) {
                return true;
            } else {
                ptr = 0;
                try {
                    bufferLength = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return bufferLength > 0;
            }
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 32600
#include <stdio.h>

#define MIN_X 0
#define MIN_Y 0
#define MAX_X 100
#define MAX_Y 100

int abs(int num) { return num > 0 ? num : -num; }

int GoodHeight(int *x, int *y, int *h, int n, int cx, int cy, int height)
{
    if (height == -1) {
        return 0;
    }

    for (int i = 0; i < n; i += 1) {
        int curr_height = height - abs(cx - x[i]) - abs(cy - y[i]);
        curr_height = (curr_height > 0 ? curr_height : 0);

        if (curr_height != h[i]) {
            return 0;
        }
    }
    return 1;
}

int FindHeight(int *x, int *y, int *h, int n, int cx, int cy)
{
    int height = -1;
    for (int i = 0; i < n; i += 1) {
        if (h[i] == 0) {
            continue;
        }

        int to_add = abs(x[i] - cx) + abs(y[i] - cy);
        if (height == -1) {
            height = to_add + h[i];
        } else if (to_add + h[i] != height) {
            return -1;
        }
    }
    return height;
}

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

    int x[n], y[n], h[n];
    for (int i = 0; i < n; i += 1) {
        scanf("%d%d%d", &x[i], &y[i], &h[i]);
    }

    for (int i = MIN_X; i <= MAX_X; i += 1) {
        for (int j = MIN_Y; j <= MAX_Y; j += 1) {
            int height = FindHeight(x, y, h, n, i, j);
            if (GoodHeight(x, y, h, n, i, j, height)) {
                printf("%d %d %d\n", i, j, height);
                return 0;
            }
        }
    }

    return 0;
}


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

int main(){
  int k,i,j,n;
  string s;
  cin >> s;
  cin >> k;
  n = s.size();

  map<string,int> dd;

  
  
  for(i=0;i<n;i++){
    for(j=1;j<=k;j++){
      if(i+j <= n){
        (dd[s.substr(i,j)])+=1;
        //cout << s.substr(i,j) << endl;
      }
    }
  }
  int res = 0;
  for(auto itr=dd.begin();itr!=dd.end();itr++){
    res++;
    if(res==k)cout << itr->first << endl;
    if(res>k)break;
  }


  return 0;
}


Measured memory_bytes: 4804
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#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 <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};


void pr(ll in){
  rep(i,5){
    rep(j,4){
      cout<<((in>>(i*4+j)*3)&7)<<' ';
    }
    cout<<endl;
  }
  cout<<endl;
}

int get(ll in,int x,int y){
  int pos=x*4+y;
  return (in>>pos*3)&7;
}

ll next(ll in,int p,int q,int len){
  in=(in&((1LL<<q*3)-1))|((in&~((1LL<<(q+1)*3)-1))>>3);
  in=(in&((1LL<<p*3)-1))|((in&~((1LL<<(p+1)*3)-1))>>3);
  return in;
}

int tx[]={1,1,1,0},ty[]={-1,0,1,1};


main(){
  int n;
  cin>>n;
  while(n--){
    ll st=0;
    rep(i,20){
      ll x;
      cin>>x;
      st|=x<<i*3LL;
    }
    queue<pair<int,ll> > q;
    q.push(mp(0,st));
    set<ll> app;
    int ans=0;
    while(!q.empty()){
      int cc=q.front().F;
      ll cst=q.front().S;
      q.pop();
      if(app.count(cst))continue;
      app.insert(cst);
      ans=cc;
      rep(i,20){
        if(((cst>>i*3)&7)==0)break;
        int cx=i/4,cy=i%4;
        rep(j,4){
          int nx=cx+tx[j],ny=cy+ty[j];
          if(nx<0 || 5<=nx || ny<0 || 4<=ny)continue;
          if(get(cst,nx,ny)==get(cst,cx,cy)){
            ll nst=next(cst,cx*4+cy,nx*4+ny,60-cc*2);
            if(app.count(nst))continue;
            q.push(mp(cc+1,nst));
          }
        }
      }
    }
    cout<<20-2*ans<<endl;
  }
}

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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;

int arr[105];

int main(){
    int n, x;
    scanf("%d %d", &n, &x);
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);
    sort(arr, arr+n);

    int ans = 0;
    ll sum = 0;
    for (int i = 0; i < n; i++){
        sum += arr[i];

        if (sum <= x)
            ans = i+1;
    }

    if (ans == n){
        if (sum == x)
            printf("%d\n", n);
        else
            printf("%d\n", n-1);
    }
    else
        printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import Data.Graph
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> Int -> VU.Vector (Int, Int, Int) -> Int
solve !n !m !xyz = length $ components $ buildG
  (0, n - 1)
  (VU.toList $ VU.map (\(x, y, z) -> (x, y)) xyz)
 where
  graph :: V.Vector [Int]
  graph = V.accumulate (flip (:)) (V.replicate n []) $ V.convert $ VU.map
    (\(x, y, z) -> (x, y))
    xyz

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  (n, m) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  uvw <-
    VU.replicateM m
    $   (\vec -> (vec VU.! 0 - 1, vec VU.! 1 - 1, vec VU.! 2))
    .   VU.unfoldrN 3 readInt
    <$> B.getLine
  print $ solve n m uvw


Measured memory_bytes: 48380
// Author: Harshdeep Sharma , IIT Indore
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
// #define MOD  998244353
#define ll long long
const double PI = atan(1.0) * 4;
// const ll INF = (int)1e9 ;
const int di[4] = { -1, 0, 1, 0} ;
const int dj[4] = {0, -1, 0, 1} ;
const ll INF = (ll)2e18 + 50;
const int maximum  = numeric_limits<int>::min();
const int minimum  = numeric_limits<int>::max();
const ll mod = 1e9 + 7 ;



ll power(ll a , ll e) {
	ll res = 1LL ;
	while (e > 0) {
		if (e % 2 == 1) res = res * a;
		a =  a * a  ;
		e /= 2 ;
	}
	return res ;
}
bool isBalanced(const string &exp)
{
	// Initialising Variables
	bool flag = true;
	int count = 0;

	// Traversing the Expression
	for (int i = 0; i < exp.length(); i++) {

		if (exp[i] == '(') {
			count++;
		}
		else {
			count--;
		}
		if (count < 0) {
			flag = false;
			break;
		}
	}
	if (count != 0) {
		flag = false;
	}

	return flag;
}

ll gcd (ll a, ll  b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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



ll power(ll x, ll y, ll mod) {
	int res = 1;
	while (y) {
		if (y & 1)
			res = res * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}




int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t ;
	// cin >> t ;
	// while (t--) {
	int x ;
	cin >> x ;
	if (x >= 400 && x <= 599) cout << 8 << "\n";
	if (x >= 600 && x <= 799) cout << 7 << "\n";
	if (x >= 800 && x <= 999) cout << 6 << "\n";
	if (x >= 1000 && x <= 1199) cout << 5 << "\n";
	if (x >= 1200 && x <= 1399) cout << 4 << "\n";
	if (x >= 1400 && x <= 1599) cout << 3 << "\n";
	if (x >= 1600 && x <= 1799) cout << 2 << "\n";
	if (x >= 1800 && x <= 1999) cout << 1 << "\n";



	// }


	return 0 ;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    char c = ' ';
    string vowel = "aiueo";
    string ans ="consonant";
    cin >> c;
    for (int i=0; i< 5; i++){
        if (c==vowel[i]){
            ans = "vowel";
            break;
        }
    }
    cout << ans;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin >> L.at(i);
  }
  int sum=0;
  int longest=0;
  for(int i=0;i<N;i++){
    longest = max(longest,L.at(i));
    sum += L.at(i);
  }
  if(sum - longest > longest){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main(){
  string cup[3]={"A","B","C"},be,af;
  char mo[3];
  int pla[3]={1,0,0},tmp[2];
  while(cin >> mo[0]){
    cin >> mo[1];
    cin >> mo[2];
    be = mo[0];
    af = mo[2];
    for(int i=0;i<3;i++){
      if(be == cup[i]){
	tmp[0]=i;
      }
      if(af == cup[i]){
	tmp[1]=i;
      }
    }
    swap(pla[tmp[0]],pla[tmp[1]]);
  }
  for(int i=0;i<3;i++){
    if(pla[i] == 1){
      cout << cup[i] << endl;
      break;
    }
  }
}

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

int main() {
	long long int N, x;
	cin >> N >> x;
	long long int a[100005];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	long long int S = 0;
	for (int i = 0; i < N-1; i++) {
		if (a[i] + a[i + 1] > x) {
			if (i == 0 && x < a[i]) {
				S += a[i] + a[i + 1] - x;
				a[i] = x;
				a[i + 1] = 0;
			}
			else {
				S += a[i] + a[i + 1] - x;
				a[i + 1] = x - a[i];
			}
		}
	}
	cout << S;
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;

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

int main() {
  long long A, B, C, D; cin >> A >> B >> C >> D;
  B++;
  long long divC, divD, divCD;
  divC = (B - 1) / C - (A - 1) / C;
  divD = (B - 1) / D - (A - 1) / D;
  long long CD = C * D / gcd(C, D);
  divCD = (B - 1) / CD - (A - 1) / CD;

  long long ans;
  ans = B - A - divC - divD + divCD;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val A = sc.nextInt()
    val x = (1..N).map { sc.nextInt() }
    val size = N * 2 * 50 + 2
    val dp = Array(N + 1) { Array(size) {0L} }
    val base = N * 50 + 1
    dp[0][base] = 1

    for (i in 0 until N) {
        for (j in 0 until size) {
            if (dp[i][j] == 0L) {
                continue
            }
            dp[i + 1][j] += dp[i][j]
            dp[i + 1][j + x[i] - A] += dp[i][j]
        }
    }
    println(dp[N][base] - 1)
}

Measured memory_bytes: 33960
#include<bits/stdc++.h>
using namespace std;
int a[6];
int main(){
	for(int i=0;i<6;i++)cin>>a[i];
	for(int i=0;i<6;i++){
		for(int j=i+1;j<6;j++){
			if(abs(a[j]-a[i])>a[5]){
				cout<<":("<<endl;
				return 0;
			}
		}
	}
	cout<<"Yay!"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 9999999999999999
typedef long long ll;
using namespace std;
int n, m;
struct edge {
public:
	int to;
	ll cost;
	edge(ll c, int t) {
		to = t;
		cost = c;
	}
};
ll d[100000];
ll a[100000];
bool used[100000];
typedef pair<ll, int> P;
vector<vector<edge> > G;
vector<vector<edge> > G1;

void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P> >q;
	fill(d, d + n, INF);
	fill(used, used + n, false);
	d[s] = 0;
	q.push(P(0, s));
	while (!q.empty()) {
		P p = q.top();
		q.pop();
		int v = p.second;
		if (used[v]) {
			continue;
		}
		ll dist = p.first;
		used[v] = true;
		d[v] = dist;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (used[e.to] == true) {
				continue;
			}
			if (d[e.to] > dist + e.cost) {
				q.push(P(d[v] + e.cost, e.to));
			}
		}
	}
}


int main() {
	int from, to;
	int s, t;
	ll cost, cost1;
	cin >> n >> m >> s >> t;
	s--;
	t--;
	G = vector<vector<edge> >(n);
	G1 = vector<vector<edge> >(n);
	for (int i = 0; i < m; i++) {
		cin >> from >> to >> cost >> cost1;
		from--;
		to--;
		G[from].push_back(edge(cost, to));
		G[to].push_back(edge(cost, from));
		G1[to].push_back(edge(cost1, from));
		G1[from].push_back(edge(cost1, to));
	}
	dijkstra(s);
	swap(d, a);
	for (int i = 0; i < n; i++) {
		swap(G[i], G1[i]);
	}
	fill(used, used + n, false);
	dijkstra(t);
	ll x[100000];
	for (int i = 0; i < n; i++) {
		x[i] = a[i] + d[i];
	}
	ll ans[100000];
	ans[n - 1] = x[n - 1];

	for (int i = n - 1; 0 < i; i--) {
		ans[i - 1] = min(x[i - 1], ans[i]);
	}
	for (int i = 0; i < n; i++) {
		cout << 1000000000000000 - ans[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 20096
#include <iostream>
#include <cmath>
#include <limits.h>
#include <stdint.h>
#include <float.h>
using namespace std;
 
int main() {
  long long A;
  double B;
  cin >> A;
  cin >> B;
  
  long long b = B * 100 + 0.5;
  A *= b;
  A /= 100;
  cout << A << endl;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int Q;
  cin >> Q;
  while (Q--) {
    int k;
    cin >> k;
    long long D = 0, M = 0, DM = 0;
    long long ans = 0;
    for (int i = 0; i < N; i++) {
      if (S[i] == 'D') D++;
      if (S[i] == 'M') M++, DM += D;
      if (S[i] == 'C') ans += DM;
      int j = i - k + 1;
      if (j >= 0) {
        if (S[j] == 'D') D--, DM -= M;
        if (S[j] == 'M') M--;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 4224
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a,b;
  int count = 0;
  cin >> a >> b;
  string s;
  cin >> s;
  for(int i=0;i<a;i++){
    if(s.at(i)=='0'||s.at(i)=='1'||s.at(i)=='2'||s.at(i)=='3'||s.at(i)=='4'||s.at(i)=='5'||s.at(i)=='6'||s.at(i)=='7'||s.at(i)=='8'||s.at(i)=='9')count++;
  }
  if(s.at(a)=='-')count++;
  for(int i=a+1;i<a+b+1;i++){
    if(s.at(i)=='0'||s.at(i)=='1'||s.at(i)=='2'||s.at(i)=='3'||s.at(i)=='4'||s.at(i)=='5'||s.at(i)=='6'||s.at(i)=='7'||s.at(i)=='8'||s.at(i)=='9')count++;    
  }
  if(count == a+b+1) cout<<"Yes"<<endl;
  else cout << "No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  char b[3][4];
  int i,f,a;
  while(1){
    scanf("%s",b[0]);
    if(b[0][0]=='0')
      break;
    scanf("%s",b[1]);
    scanf("%s",b[2]);
    f=1;
    for(i=0;i<3;i++){
      if(b[i][0]!='+'&&b[i][0]==b[i][1]&&b[i][1]==b[i][2]){
	a=b[i][0];
	f=0;
      }
      if(b[0][i]!='+'&&b[0][i]==b[1][i]&&b[1][i]==b[2][i]){
	a=b[0][i];
	f=0;
      }
    }
    if(b[1][1]!='+'&&(b[0][0]==b[1][1]&&b[1][1]==b[2][2]||b[0][2]==b[1][1]&&b[1][1]==b[2][0])){
      a=b[1][1];
      f=0;
    }
    if(f)
      puts("NA");
    else
      printf("%c\n",a);
  }
  return 0;
}

Measured memory_bytes: 548
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF 999999999
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

//4近傍
//int dy[]={0, 0, 1, -1};
//int dx[]={1, -1, 0, 0};

//8近傍
int dy[]={0,0,1,-1,1,1,-1,-1};
int dx[]={1,-1,0,0,1,-1,1,-1};

ll mod = 1000000007;

void solve() {
    int n,l; cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    VSORT(s);
    rep(i,n) cout << s[i];
    cout << endl;

}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	/*int p, q, r;
	scanf("%d %d %d", &p, &q, &r);
	int a, b, c;
	a = p + q;
	b = q + r;
	c = r + p;
	printf("%d\n", MIN(a, MIN(b, c)));*/

	int n;
	int w[101];
	scanf("%d", &n);
	scanf("%d", &w[0]);
	int first = w[0];
	int last = 0;
	for (int i = 1; i < n; i++) {
		scanf("%d", &w[i]);
		last += w[i];
	}

	int min = abs(first - last);
	for (int i = 1; i < n-1; i++) {
		first += w[i];
		last -= w[i];
		int temp = abs(first - last);
		if (min > temp) {
			min = temp;
		}
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
/**
  @date Time-stamp: <2019-04-13 22:05:44 tagashira>
  @file a.cpp
  @brief https://atcoder.jp/contests/abc123/tasks/abc123_b
**/

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int> H;
  int tmp;
  int i;
  for (i = 0; i < N; i++) {
    cin >> tmp;
    H.push_back(tmp);
  }

  // for (i = 0; i < N; i++) {
  //   cout << H[i] << "\n";
  // }

  int cansee = 0;
  for (i = 0; i < N; i++) {
    auto last = H.begin() + i + 1;
    // cout << "last " << *last << "\n";
    // cout << H[i] << ":" << *max_element(H.begin(), last) << "\n";
    if (H[i] == *max_element(H.begin(), last)) {
      cansee++;
    }
  }

  cout << cansee << "\n";

  return 0;
}


Measured memory_bytes: 256
def solve(s1):
    div = 1000000007
    s1 = iter(s1)
    try:
        a = next(s1)
        b = next(s1)
    except:
        return 3
    if a != b:
        a = b
        try:
            b = next(s1)
        except:
            return 6
    ans = 3
    state = 0
    while True:
        if a == b:
            ans *= 3 if state else 2
            ans %= div
            try:
                a = next(s1)
                b = next(s1)
            except:
                return ans
            state = 1
        else:
            ans *= 1 if state else 2
            ans %= div
            try:
                a = b
                b = next(s1)
            except:
                return ans * 2 % div
            state = 0


input()
print(solve(input().strip()))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 998244353
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   


int main() 
{ 
    ll h1, m1, h2, m2, k;
    cin>>h1>>m1>>h2>>m2>>k;

    ll minutes1 = h1*60+m1;
    ll minutes2 = h2*60+m2;
    ll dif = abs(minutes1-minutes2);
    cout<<dif-k<<endl;
} 

Measured memory_bytes: 3624