akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int W,H;
int ary[110][110];//[x][y]
int isou[110][110]={};//[x][y]

class coord{
public:
	int x,y;
	coord(){
		x=0;y=0;
	}
	coord(int xx,int yy){
		x=xx;
		y=yy;
	}
};

coord tonari(int x,int y,int m);

void arych(int x,int y){
	coord a;
	if(isou[x][y]==0){
		isou[x][y]=2;
		for(int i=0;i<6;i++){
			a=tonari(x,y,i);
			if(a.x!=0&&a.y!=0&&a.x!=W+1&&a.y!=H+1){
				if(isou[a.x][a.y]==0){
					arych(a.x,a.y);
				}
			}
		}
	}
}



coord tonari(int x,int y,int m){
	switch(m){
	case 0:
		if(y%2==0)return coord(x-1,y-1);
		else return coord(x,y-1);
		break;
	case 1:
		if(y%2==0)return coord(x,y-1);
		else return coord(x+1,y-1);
		break;
	case 2:
		return coord(x+1,y);
		break;
	case 3:
		if(y%2==0)return coord(x,y+1);
		else return coord(x+1,y+1);
		break;
	case 4:
		if(y%2==0)return coord(x-1,y+1);
		else return coord(x,y+1);
		break;
	case 5:
		return coord(x-1,y);
		break;
	}
	return coord();
}

int main(){
	int sum,ti,tj,deb;
	coord c;
	cin>>W>>H;
	for(int i=0;i<=W+1;i++){
		for(int j=0;j<=H+1;j++){
			isou[i][j]=2;
		}
	}
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin>>isou[j][i];
		}
	}
	/*
	for(int i=1;i<=W;i++){
		for(int j=1;j<=H;j++){
			cout<<"??´???["<<i<<"]["<<j<<"]="<<isou[i][j]<<" ";//
		}
		cout<<endl;//
	}
	*/
	for(int i=1;i<=W;i++){
		arych(i,1);
		arych(i,H);
	}
	for(int i=1;i<=H;i++){
		arych(1,i);
		arych(W,i);
	}
	sum=0;
	for(int i=1;i<=W;i++){
		for(int j=1;j<=H;j++){
			deb=-sum;
			for(int k=0;k<6;k++){
				c=tonari(i,j,k);
				ti=c.x;
				tj=c.y;
				if(isou[i][j]==1&&isou[ti][tj]==2) sum++;
			}
			deb+=sum;
			//cout<<"??£??\["<<i<<"]["<<j<<"]="<<deb<<" ";//
			
		}
		//cout<<endl;//
	}
	/*
	for(int i=1;i<=W;i++){
		for(int j=1;j<=H;j++){
			cout<<"??´???["<<i<<"]["<<j<<"]="<<isou[i][j]<<" ";//
		}
		cout<<endl;//
	}
	*/
	cout<<sum<<endl;
	return 0;
}

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

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

    if (A == 'H' && B== 'H')
    {
        cout << 'H' << endl;
    }
    else if (A == 'H' && B == 'D')
    {
        cout << 'D' << endl;
    }
    else if (A == 'D' && B == 'H')
    {
        cout << 'D' << endl;
    }
    else if (A == 'D' && B == 'D')
    {
        cout << 'H' << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=200005;
int n,K,L;
struct Union_Find
{
	int fa[MAX_N];
	void init()
	{
		for(int i=1;i<=n;i++)
		{
			fa[i]=i;
		}
	}
	int find(int x)
	{
		return x==fa[x]?x:fa[x]=find(fa[x]);
	}
	void unite(int a,int b)
	{
		fa[find(a)]=find(b);
	}
	bool same(int a,int b)
	{
		return find(a)==find(b);
	}
	void update()
	{
		for(int i=1;i<=n;i++)
		{
			find(i);
		}
	}
}rail,road;
map <pair<int,int>,int> connect;
int main()
{
	cin>>n>>K>>L;
	rail.init();
	road.init();
	while(K--)
	{
		int p,q;
		cin>>p>>q;
		road.unite(p,q);
	}
	while(L--)
	{
		int r,s;
		cin>>r>>s;
		rail.unite(r,s);
	}
	road.update();
	rail.update();
	for(int i=1;i<=n;i++)
	{
		connect[make_pair(road.fa[i],rail.fa[i])]++;
	//	cout<<"("<<road.fa[i]<<","<<rail.fa[i]<<")"<<endl;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<connect[make_pair(road.fa[i],rail.fa[i])]<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 13568
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD (ll)1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n, m) for (int i = (n), i < (m); i++)

int
main(int argc, char *argv[])
{
  int t1, t2, r1, r2;
  scanf("%d %d %d %d", &t1, &t2, &r1, &r2);

  if (r1 == -1 || r2 == -1) {
    if (t1 < t2) printf("Alice\n");
    if (t2 < t1) printf("Bob\n");
    if (t1 == t2) printf("Draw\n");
  } else {
    if (r1 > r2) printf("Alice\n");
    if (r2 > r1) printf("Bob\n");
    if (r1 == r2) printf("Draw\n");
  }

  return 0;
}



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

const int MOD = 1e9+7;
int add(int a, int b){return ((ll)a + (ll)b)%MOD;}
int sub(int a, int b){return add(a+MOD, -b);}
int mul(int a, int b){return ((ll)a * (ll)b)%MOD;}

void solve(){
    int n; cin >> n;
    vector<int> a(n), p(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        p[i] = (i+1) + a[i];
    }
    sort(p.begin(), p.end());
    ll ans = 0;
    for(int i = 0; i < n; i++){
        int s = (i+1) - a[i];
        ans += upper_bound(p.begin(), p.end(), s) - lower_bound(p.begin(), p.end(), s);
    }
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;

int v[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(int argc, char const* argv[])
{
  int c; cin >> c;
  cout << v[c-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using graph = vector<vector<pii>>;

void dfs(int v, int prev, int c, const graph& G, vector<int>& col){
    int it = 1;
    for(auto e : G[v]) if(e.first != prev) {
        if(it == c) ++it;
        col[e.second] = it;
        dfs(e.first, v, it++, G, col);
    }
}

int main()
{
    int N;
    cin >> N;
    vector<int> u(N - 1), v(N - 1);
    graph G(N);
    for(int i = 0;i < N - 1;i++){
        cin >> u[i] >> v[i]; --u[i], --v[i];
        G[u[i]].emplace_back(v[i], i);
        G[v[i]].emplace_back(u[i], i);
    }
    vector<int> col(N - 1);
    dfs(0, -1, 0, G, col);
    cout << *max_element(col.begin(), col.end()) << '\n';
    for(int i = 0;i < N - 1;i++){
        cout << col[i] << '\n';
    }
    return 0;
}


Measured memory_bytes: 8832
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
	public static void main(String[] args)throws IOException{
	
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		
		int n = Integer.parseInt(br.readLine());
		
		int[][][] count = new int[4][3][10];
		
		for(int i=0; i<4; i++){
			for(int j=0; j<3; j++){
				for(int k=0; k<10; k++){
					count[i][j][k] = 0;
				}
			}
		}
		for(int i=0; i<n; i++){
			String[] line = br.readLine().split(" ");
			int b = Integer.parseInt(line[0]) - 1;
			int f = Integer.parseInt(line[1]) - 1;
			int r = Integer.parseInt(line[2]) - 1;
			int v = Integer.parseInt(line[3]);
			count[b][f][r] += v;
		}
		
		for(int i=0; i<4; i++){
			if(i != 0){
				System.out.println("####################");
			}
			for(int j=0; j<3; j++){
				for(int k=0; k<10; k++){
					System.out.print(" ");
					System.out.print(count[i][j][k]);
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 24628
function year(x){
   var m=[365,31,28,31,30,31,30,31,31,30,31,30,31];
   if(x%4==0){
      m[2]=29;
      m[0]=366;
      if(x%100==0){m[2]=28;m[0]=365;}
      if(x%400==0){m[2]=29;m[0]=366;}
   }
   return m;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var str=Arr.shift();
   if(str=="-1 -1 -1 -1 -1 -1")break;
   var arr=str.split(" ").map(Number);
   (function(y1, m1, d1, y2, m2, d2){
      var sum1=0;
      var sum2=0;
      var Y1=year(y1);
      var Y2=year(y2);
      sum1+=Y1[m1]-d1;
      sum2+=Y2[m2]-d2;
      while(m1<12){m1++;sum1+=Y1[m1];}
      while(m2<12){m2++;sum2+=Y2[m2];}
      var days=sum1-sum2;
      while(y1!=y2){
         y1++;
         days+=(year(y1))[0];
      }
      console.log(days);
   }).apply(null,arr);
}

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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N, K;cin>>N>>K;
    vec_int p(N);
    rep(i,N)cin>>p.at(i);


    sort(p.begin(),p.end());
    int tot = 0;
    rep(i,K)tot+=p.at(i);
    cout<<tot<<endl;


    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  comi();
  LL n,i,ans=0,a,b,min=1,m=1;
  scanf("%lld%lld%lld",&n,&a,&b);
  ans=POW(2,n)-1;
  //ans-=com(n,a)+com(n,b);
  rep(i,a)min=(min*(n-i))%MOD;
  min=(min*finv[a])%MOD;
  rep(i,b)m=(m*(n-i))%MOD;
  m=(m*finv[b])%MOD;
  ans=mod(ans-min-m,MOD);

  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4864
#include <stdio.h>

int main(){
    int c[3][3], flag = 1;
    for(int i = 0; i < 3; i++){
        scanf("%d %d %d", &c[i][0], &c[i][1], &c[i][2]);
    }

    for(int i = 0; i < 3; i++){
        if(c[1][0] - c[0][0] != c[1][i] - c[0][i]){
            flag = 0;
            break;
        }
        if(c[2][0] - c[1][0] != c[2][i] - c[1][i]){
            flag = 0;
            break;
        }
        if(c[0][1] - c[0][0] != c[i][1] - c[i][0]){
            flag = 0;
            break;
        }
        if(c[0][2] - c[0][1] != c[i][2] - c[i][1]){
            flag = 0;
            break;
        }
    }
    printf((flag == 1) ? "Yes\n" : "No\n");
    return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;

#define rep(i, a, b) for(auto i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back

struct edge{int to;};
using graph = vector<vector<edge>>;

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

  string s, t;
  cin >> s >> t;
  if (sz(s) == sz(t) - 1 and t.substr(0, sz(s)) == s) cout << "Yes" << '\n';
  else cout << "No" << '\n';
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
 
int n;
double r[500];
double ans[500];
double ans2=0;
 
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>r[i];
    double maxm=r[i];
    for(int j=0;j<i;j++){
      double A=r[i]+r[j];
      double B=r[i]-r[j];
      double C=sqrt(A*A-B*B);
      maxm=max(maxm,ans[j]+C);
    }
    ans[i]=maxm;
    ans2=max(ans2,ans[i]+r[i]);
  }
  printf("%.8f\n",ans2);
  return 0;
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n];
  rep(i,n){
    cin>>a[i];
  }
  Rep(i,k,n){
    Ans(a[i-k]<a[i]);
  }
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int n = sc.intarr[0];

            int child = n - (n / 2);
            float ans = (float)child / n;

            wr.wri(ans);


        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13268
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadInt();
            var a = ReadInt();
            var b = ReadInt();
            var s = x - a;
            var s1 = s / b;
            WriteLine(s - s1 * b);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define MOD 1000000007
using namespace std;

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

	ll a,b,k;
	cin >> a >> b >> k;
	
	if (k>=a)
	{
		k=k-a;
		a=0;
	}
	else
	{
		a=a-k;
		k=0;
	}

	if (k>=b)
	{
		b=0;
	}
	else
	{
		b=b-k;
	}
	
	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  int i;
  int ans = 0;
  for(i=0;i<2;i++){
    if(a<b){
      ans += b;
      b--;
    }
    else{
      ans += a;
      a--;
    }
  }
  printf("%d\n",ans);


}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
    vector <string> v({"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"});
    string s;
    cin >> s;
    for (int i = 0; i < 7; i++) {
        if(v[i] == s) {
            cout << 7 - i << "\n";
            break;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>

using lli = long long int;
int inf = 1000000007;
using namespace std;
#define sort(X) sort(X.begin(),X.end())

int A, P;

int main()
{
	cin >> A >> P;
	cout << (A * 3 + P) / 2 << endl;
	return 0;
}

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

int main() {
  double N, T, A;
  cin >> N >> T >> A;
  int H[int(N)];
  double ave[int(N)];
  for (int i = 0; i < N; i++) {
    cin >> H[i];
    ave[i] = T - double(H[i]) * 0.006;
  }
  double temp = 100000;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (abs(ave[i] - A) < temp) {
      temp = abs(ave[i] - A);
      ans = i;
    }
  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 256
s = list(input())

max_num = min(len(s),5)

if len(s) == 2 and s[0] == s[1]:
    print(1,2)
    exit()

for k in range(3,max_num,2):
    l = [0]*26
    for kk in range(k):
        l[ord(s[kk])-97] += 1
    if max(l) == (k+1)//2:
        print(1,k)
        exit()

    for i in range(k,len(s)):
        l[ord(s[i-k])-97] -= 1
        l[ord(s[i])-97] += 1
        if max(l) == (k+1)//2:
            print(i-k+2,i+1)
            exit()

print(-1,-1)


Measured memory_bytes: 49648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < 2; i++)
    {
        if (a > b)
        {
            swap(a, b);
        }
        if (b > c)
        {
            swap(b, c);
        }
    }
    if (a + b == c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

namespace SCC{
    void visit(const vector<vector<int>>&G,vector<int>&vs,vector<int>&used,int v){
        used[v]=true;
        for(auto u:G[v]){
            if(!used[u])visit(G,vs,used,u);
        }
        vs.push_back(v);
    }

    void visit2(const vector<vector<int>>&T,vector<int>&used,vector<int>&comp,vector<int>&vec,int k,int v){
        comp[v]=k;
        used[v]=true;
        vec.push_back(v);

        for(auto u:T[v]){
            if(!used[u])visit2(T,used,comp,vec,k,u);
        }
    }

    void decompose(const vector<vector<int>>&G,vector<vector<int>>&H,vector<int>&comp){
        vector<vector<int>>T(G.size());
        for(int i=0;i<G.size();i++){
            for(auto v:G[i]){
                T[v].push_back(i);
            }
        }
        comp.resize(G.size());

        vector<int>vs(G.size());
        vector<int>used(G.size());
        for(int i=0;i<G.size();i++){
            if(!used[i])visit(G,vs,used,i);
        }
        reverse(vs.begin(),vs.end());
        fill(used.begin(),used.end(),0);

        int K=0;
        vector<vector<int>>S;
        for(auto v:vs){
            if(!used[v]){
                S.push_back(vector<int>());
                visit2(T,used,comp,S.back(),K++,v);
            }
        }

        H.resize(K);
        fill(used.begin(),used.end(),0);
        for(int i=0;i<K;i++){
            for(auto v:S[i]){
                for(auto u:G[v]){
                    if(used[comp[u]]||comp[v]==comp[u])continue;
                    used[comp[u]]=true;
                    H[comp[v]].push_back(comp[u]);
                }
            }
            for(auto v:H[i])used[v]=false;
        }

    }
}

signed main(){
    int N,M;
    cin>>N>>M;

    vector<vint>G(N),H;
    vint comp;

    rep(i,M){
        int a,b;
        cin>>a>>b;
        G[a].pb(b);
    }

    SCC::decompose(G,H,comp);

    vint degin(N),degout(N);

    rep(i,H.size())for(auto u:H[i])degin[u]++,degout[i]++;

    int x=0,y=0;
    rep(i,H.size())x+=degin[i]==0,y+=degout[i]==0;

    if(H.size()==1)cout<<0<<endl;
    else cout<<max(x,y)<<endl;
    return 0;
}

Measured memory_bytes: 8148
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){
  
  string s1,s2,s3;
  cin>>s1>>s2>>s3;
  cout<< s1[0]<<s2[1]<<s3[2]<<"\n";
  
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, l, r, x = 1, y;
    cin >> n >> m; y = n;
    while (m--) cin >> l >> r, x = max(x, l), y = min(y, r);
    cout << max(0, y - x + 1);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n;
  int a;
  int b;
  int c;
  int d;
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  char road[n];
  scanf("%s", road);
  int i;
  if(c<d){
    for(i=a;i<d;i++){
      if(road[i-1]=='#'&&road[i]=='#'){
        printf("No");
        return 0;
      }
    }
    printf("Yes");
    return 0;
  }else{
    for(i=b-1;i<d;i++){
      //printf("%d", i);
      if(road[i-1]=='.'&&road[i]=='.'&&road[i+1]=='.'){
        printf("Yes");
        return 0;
      }
    }
    printf("No");
    return 0;
  }
  return 0;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
		int[][] dp = new int[N+1][N+1];
		for(int i = N-1; i >= 0; i--) {
			for(int j = N-1; j >= 0; j--) {
				if(S[i] == S[j])
					dp[i][j] = dp[i+1][j+1] + 1;
				else
					dp[i][j] = 0;
			}
		}
		int ans = 0;
		for(int i = 0; i < N; i++)
			for(int j = i+1; j < N; j++)
				ans = Math.max(ans, Math.min(dp[i][j], j-i));
		System.out.println(ans);

	}

}

Measured memory_bytes: 167960
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b; b = c % b;
	}
	return a;
}
inline ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
bool isprime(ll n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
ll mypow(ll a, ll b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	ll memo = mypow(a, b >> 1);
	return memo * memo;
}
int n, a[1000010];
string s;
signed main() {
	cin >> n >> s;
	rep(i, n)a[i] = s[i] - '0';
	int cnt = 0;
	rep(i, n) {
		if ((i | (n - 1)) == n - 1)cnt += a[i];
	}
	if (cnt % 2)cout << 1 << endl;
	else {
		int tcount = 0;
		rep(i, n - 1) {
			if (abs(a[i] - a[i + 1]) == 1) {
				cout << 0 << endl;
				return 0;
			}
		}
		rep(i, n)a[i] /= 2;
		cnt = 0;
		rep(i, n) {
			if ((i | (n - 1)) == n - 1)cnt += a[i];
		}
		if (cnt % 2)cout << 2 << endl;
		else cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 9204
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int MINF = -1e9;;


vector<ll> divisors(ll n) {
	vector<ll> res;
	for (ll i = 1; i*i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}


int main() {
	ll n;
	cin >> n;
	vector<ll> ans;
	ans = divisors(n);
	sort(ans.begin(), ans.end());
	ll cnt = ans.size();
	if (ans.size() % 2 != 0) {
		cout << ans[cnt / 2] + ans[cnt / 2] - 2 << endl;
		return 0;
	}
	cnt /= 2;
	cout << ans[cnt - 1] + ans[cnt] - 2 << endl;

	return 0;
}


Measured memory_bytes: 384
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"

for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] = H[i+1]-1
    if H[i] > H[i+1]:
        ans = "No"
        break

print(ans)


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

#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define true 1
#define false 0

typedef struct unionFind{
	int par;
	int vertext;
	int count;
} unionFind;


unionFind* uf_make(int n){
	unionFind* u;
	u = calloc(sizeof(unionFind),n);
	return u;
}

void uf_init(int n,unionFind *u){
	int i;
	for(i = 0;i < n;i++){
		u[i].par = i;
		u[i].count = 1;
	}
}
int uf_root(int x,unionFind *u){
	if(u[x].par == x){
		return x;
	}else{
		return u[x].par = uf_root(u[x].par,u);
	}
}
int uf_same(int x,int y,unionFind *u){
	return uf_root(x,u) == uf_root(y,u);
}
void uf_unite(int x,int y,unionFind *u){
	x = uf_root(x,u);
	y = uf_root(y,u);
	if(x == y)return;
	u[x].par = y;
	u[y].count += u[x].count;
}
int uf_count(int x,unionFind *u){
	x = uf_root(x,u);
	return u[x].count;
}

typedef struct rode {
	lli cost;
	int i;
	int j;
	int p;
} rode;

int comp(const void *a,const void *b){
	return ((rode*)a)->cost - ((rode*)b)->cost;
}

int main(void){
	int i,j;
	int w,h;
	int wh;
	rode *pq;
	lli ans = 0;
	scanf("%d%d",&w,&h);
	pq = calloc(sizeof(rode),w+h);
	for(i=0;i<w;i++){
		scanf("%lld",&pq[i].cost);
		pq[i].i = i;
		pq[i].p = true;
	}
	for(j=0;j<h;i++,j++){
		scanf("%lld",&pq[i].cost);
		pq[i].j = j;
	}
	qsort(pq,w+h,sizeof(rode),comp);
	wh = w+h;
	w++;
	h++;
	for(i=0;i<wh;i++){
		if(pq[i].p){
			ans += pq[i].cost * h;
			w--;
		}else{
			ans += pq[i].cost * w;
			h--;
		}
	}
	printf("%lld\n", ans);


	return 0;
}

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

class union_find{
    int_fast64_t n;
    vector<int_fast64_t> v;
public:
    union_find(int_fast64_t _n) : n(_n), v(_n, -1){}
    int_fast64_t find(int_fast64_t x){
        return v[x] >= 0 ? v[x] = find(v[x]) : x;
    }
    bool same(int_fast64_t x, int_fast64_t y){
        return find(x) == find(y);
    }
    bool unite(int_fast64_t x, int_fast64_t y){
        x = find(x);
        y = find(y);
        if(x == y)return false;
        if(v[x] > v[y])swap(x, y);
        v[y] = x;
        return true;
    }
};

int main(){
    int_fast64_t N, M;
    scanf("%lld%lld", &N, &M);
    union_find uf(N + M);
    for(int_fast64_t i = 0, K; i < N; ++i){
        scanf("%lld", &K);
        for(int_fast64_t j = 0, L; j < K; ++j){
            scanf("%lld", &L);
            uf.unite(i, N + L - 1);
        }
    }
    for(int_fast64_t i = 1; i < N; ++i){
        if(!uf.same(i - 1, i))return 0 & puts("NO");
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



int main()
{
    int n;
    cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    if(n == 2){
        cout << 2 << endl;
        return 0;
    }
    mint ans = 1;
    rep(i, 0, n){
        ans *= 10;
    }
    mint diff = 1;
    rep(i, 0, n){
        diff *= 9;
    }
    mint sum = 1;
    rep(i, 0, n){
        sum *= 8;
    }
    cout << ans - diff*2 + sum << endl;
    return 0;
}


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

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

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int main() {
  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if (d2 == 1) cout << 1 << endl;
  else cout << 0 << endl;

  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = []
for idx in range(1, N + 1):  # N = 100, no need to use sys.stdin
    S, P = input().split()
    ans.append((S, int(P), idx))

ans.sort(key=lambda x: (x[0], -x[1]))
for pair in ans:
    print(pair[2])


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

struct Node{
	int key;
	Node *parent, *left, *right;
};

Node *root, *NIL;



// ここからプロトタイプ宣言
void insert(int k);
Node* find(Node *u, int k);
Node* treeMinimum(Node *x);
Node* treeSuccesor(Node *x);
void treeDelete(Node *z);

void inOrder(Node *u);
void preOrder(Node *u);
// ここまでプロトタイプ宣言

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

	int x;
	for(int i=0;i<n;i++){
		cin>>com;
		if(com=="insert"){
			cin>>x;
			insert(x);
		}else if(com=="print"){
			inOrder(root);
			printf("\n");
			preOrder(root);
			printf("\n");
		}else if(com[0]=='f'){
			cin>>x;
			Node *t = find(root,x);
			if(t!=NIL)
				printf("yes\n");
			else
				printf("no\n");
		}else if(com=="delete"){
			cin>>x;
			treeDelete(find(root,x));
		}
	}

	return 0;
}


//---------------------//
void insert(int k){
	Node *y = NIL;	// xの親
	Node *x = root;
	Node *z;

	z = (Node*)malloc(sizeof(Node));
	// コレないとエラー。　コレ何してる？

	z -> key = k;
	z -> left = NIL;
	z -> right = NIL;

	while(x != NIL){
		y=x;

		if(z->key < x->key){
			x = x->left;
		}else{
			x = x->right;
		}
		// このループで、z の親を探してる？
		// 見つけた親を、y に代入？
	}

	z->parent = y;
	if(y==NIL){
		root=z;

	}else{
		// ノード挿入

		if(z->key < y->key){
			y->left = z;
		}else{
			y->right = z;
		}
	}
}

void inOrder(Node *u){
	if(u==NIL)return;

	inOrder(u->left);
	printf(" %d",u->key);
	inOrder(u->right);
}

void preOrder(Node *u){
	if(u==NIL)return;

	printf(" %d",u->key);
	preOrder(u->left);
	preOrder(u->right);
}


Node* find(Node *u , int k){
	while(u!=NIL && k != u->key){
		if(k > u->key){
			u=u->right;
		}else{
			u=u->left;
		}
	}
	return u;
}

Node* treeMinimum(Node *x){
	while(x->left != NIL) x = x->left;
	return x;
}

Node* treeSuccesor(Node *x){	// 次接点の探索
	if(x->right != NIL) return treeMinimum(x->right);

	Node *y = x->parent;
	while(y!=NIL && x==y->right){	// x が親の右の子のとき
		x=y;
		y=y->parent;

		// 1こ上に登ってる？
	}
	return y;
}

void treeDelete(Node *z){
	Node *y;	// 削除対象
	Node *x;	// y の子

	// 削除する接点を決める
	if(z->left==NIL || z->right==NIL) y=z;
	else y=treeSuccesor(z);

	// y の子 x を決める
	if(y->left != NIL){
		x=y->left;
	}else{
		x=y->right;
	}

	if(x != NIL)	x->parent = y->parent;

	if(y->parent==NIL)
		root=x;
	else{
		if(y==y->parent->left){
			y->parent->left =x;
		}else{
			y->parent->right = x;
		}
	}

	if(y != z)z->key = y->key;

	free(y);
}



Measured memory_bytes: 22024
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cassert>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main()
{
	int x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2;
	int dx=x2-x1,dy=y2-y1;
	x3=x2-dy;y3=y2+dx;
	x4=x3-dx;y4=y3-dy;
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
}

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

using namespace std;
int main() {
    int i, j, n, m,p;
    int count=0;
    int goukei=0;
    int temp;
    cin >> n >> m;
    int a[m][2];
    int kazu[n];
    for(i=0; i<m; i++){
        for(j=0; j<2; j++) {
            cin >> a[i][j];
        }
    }
    for(i=0; i<n; i++){kazu[i]=0;}
    do{
        count=0;
        for(p=1; p<=n; p++) {
            for (i = 0; i < m; i++) {
                for (j = 0; j < 2; j++) {
                    if (a[i][j] ==p){kazu[p-1]=kazu[p-1]+1;temp=i;}
                }
            }
            if(kazu[p-1]==1){a[temp][0]=-1;a[temp][1]=-1;count++;}
            if(kazu[p-1]!=0){kazu[p-1]=0;}
        }
        goukei=goukei+count;
    }while(count != 0);

    cout << goukei;
    return 0;
}

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

int main() {
    string s; cin >> s;
    int l = 0, r = s.size()-1;
    long long ans = 0, c = 0;
    while (l <= r && s[l] == '>') c++, l++;
    ans += c * (c + 1) / 2;
    c = 0;
    while (l <= r && s[r] == '<') c++, r--;
    ans += c * (c + 1) / 2;
    while (l < r) {
        long long a = 0, b = 0;
        while (s[l] == '<') l++, a++;
        while (s[l] == '>') l++, b++;
        ans += max(a, b) + a * (a - 1) / 2 + b * (b - 1) / 2;
    }
    cout << ans << endl;
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    ll s,w; cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3640
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  a, b = map(int, input().split())

  x = a + (a - 1)
  y = b + (b - 1)
  z = a + b

  print(max(x, y, z))


if __name__ == '__main__':
  main()



Measured memory_bytes: 2940
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

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

  cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
b=list(map(int,input().split()))
ans=[]
for i in range(n):
  if b[i]-1>len(ans):
    print(-1)
    break
  else:
    ans.insert(b[i]-1,b[i])
else:
  for i in range(n):
    print(ans[i])


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

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define watch(x);       cout << "\n" <<  #x << " is: " << x << "\n";
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd(a,b)
#define sq(a)           (a)*(a)
#define loop(i,a,b)     for (ll i = a; i <= b; i++)
#define rloop(i,a,b)    for (int i = a; i >= b; i--)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)

int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        ll a[n];
        map<ll,ll>mp;

        loop(i,0,n-1)
        {
            cin>>a[i];
            mp[a[i]]++;
        }
        ll ans=0;
        for(int i=0;i<sz(mp);i++)
             ans+=mp[i]*(mp[i]-1)/2;
        loop(i,0,n-1)
        {
            ll p=mp[a[i]];
            ll x=((p-1)*(p-2)/2)-(p*(p-1)/2);
            cout<<ans+x;
            nl;
        }

    }
    return 0;
}


Measured memory_bytes: 17692
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

const long long int INF = 1e9;

typedef pair<long long int,int> P;

int main(){
  int n;
  while(cin>>n,n){
    vector<pair<int,int> > building(n);
    for(int i=0;i<n;++i){
      int b,x,y;
      cin>>b>>x>>y;
      building[b-1] = make_pair(x,y);
    }
    vector<vector<int> > G(n);
    for(int i=0;i<n;++i) G[i] = vector<int>(n);
    for(int i=0;i<n;++i){
      for(int j=i;j<n;++j){
        int ax = building[i].first;
        int ay = building[i].second;
        int bx = building[j].first;
        int by = building[j].second;
        double dist = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
        G[i][j] = (dist<=50.0)?dist:INF;
        G[j][i] = (dist<=50.0)?dist:INF;
      }
    }
    int m;cin>>m;
    for(int i=0;i<m;++i){//Dijkstra(arihon)
      int s,g;cin>>s>>g;
      s--;g--;
      vector<int> prev(n);
      for(int i=0;i<n;++i)prev[i] = i;
      vector<long long int> d(n,INF);
      priority_queue<P, vector<P>, greater<P> > q;
      d[s]=0;q.push(P(0,s));
      while(!q.empty()){
        P p = q.top();q.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int j=0;j<G[v].size();++j){
          if(p.first + G[v][j] < d[j]){
            d[j] = p.first + G[v][j];
            //cerr<<"#"<<v+1<<" "<<j+1<<" "<<d[j]<<endl;
            q.push(P(d[j],j));
            prev[j] = p.second;
          }
        }
      }
      int x = g;
      vector<int> w;
      while(x!=s&&x!=prev[x]){w.push_back(prev[x]);x=prev[x];}
      if(w.size()){
	      for(int j=w.size()-1;j>=0;--j)cout<<w[j]+1<<" ";
	      cout<<g+1<<endl;
      }else{
      	cout<<"NA"<<endl;
      }
    }
    
  }
  return 0;
}

Measured memory_bytes: 1268
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	ll R, G, B, n, count = 0;
	cin >> R >> G >> B >> n;
	for (ll i = 0; i <= 3000; i++) {
		for (ll j = 0; j <= 3000; j++) { 
			ll a = i * R + j * G;
			if (a<=n&&(n-a)%B==0) {
				//cout << i << " " << j << " " << (n - R*i - G*j)/B << endl;
				count++;
			}
		}
	}
	cout << count << endl; 
}


Measured memory_bytes: 256