akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N, Q;
    cin >> N >> Q;
    string s;
    cin >> s;
    vector<char> t(Q), d(Q);
    REP(i, Q) cin >> t[i] >> d[i];

    int ans_left, ans_right;

    // 左にギリギリ落ちないものを二分探索
    int left = 0, right = N; // 左に全部落ちる場合に備えて N から
    while(left < right){
        int mid = (left+right)/2;
        int pos = mid;
        REP(i, Q){
            if(t[i] == s[pos]){
                if(d[i] == 'L') --pos;
                if(d[i] == 'R') ++pos;
                if(pos < 0){
                    left = mid+1;
                    break;
                }
                if(pos >= N) break;
            }
        }
        if(pos >= 0) right = mid;
        // cout << "left: " <<  left << " " << right << endl;
    }
    ans_left = left;

    left = -1, right = N-1; // 右に全部落ちる場合に備えて -1 から
    // 右にギリギリ落ちないものを二分探索
    while(left < right){
        int mid = (left+right+1)/2;
        int pos = mid;
        REP(i, Q){
            if(t[i] == s[pos]){
                if(d[i] == 'L') --pos;
                if(d[i] == 'R') ++pos;
                if(pos < 0) break;
                if(pos >= N){
                    right = mid-1;
                    break;
                }
            }
        }
        if(pos < N) left = mid;
        // cout << "right: " << left << " " << right << endl;
    }
    ans_right = right;

    cout << max(0, ans_right-ans_left+1) << endl;


    return 0;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
string ao(string str)
{
	string s = str;
	int pos = str.size()-1;
	while( true )
	{
		s[pos]++;
		char ma = 'a';
		for(int i=0;i<pos;i++)
		{ 
			if(s[i]>ma)
				ma = s[i]; 
		} 
		if(s[pos]-ma>1)
		{
			s[pos] = 'a';
			pos--;
		}
		else
			break;
	}
	return s;
}
int main()
{
	int n;
	cin>>n;
	string str = "";
	for(int i=0;i<n;i++)
	{
		str+='a';
	}
	cout<<str<<endl;
	string s = str;
	while(1)
	{
		s = ao(s);
		if(s[0] == 'a')
		cout<<s<<endl;
		else
		break;
	}
	return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    struct Position { internal int x, y, depth; }

    class Puzzle
    {
        readonly int[] moveX = new int[] { -2, -2, -2, -1,  0, +1, +2, +2, +2, -1,  0, +1 };
        readonly int[] moveY = new int[] { -1,  0, +1, -2, -2, -2, -1,  0, +1, +2, +2, +2 };

        readonly int n;

        bool[,,] map;
        
        public Puzzle(int n)
        {
            this.n = n;
            map = new bool[n, 10, 10];
        }
        
        public void MakeMap(int depth,int x,int y)
        {
            for(int i = -1; i <= 1; i++)
            {
                for(int j = -1; j <= 1; j++)
                {
                    int tempX = x + j;
                    int tempY = y + i;

                    if (!IsValid(tempX, tempY)) continue;

                    map[depth, tempY, tempX] = true;
                }
            }
        }

        public bool Solve(Position pos)
        {
            Stack<Position> stk = new Stack<Position>();
            stk.Push(pos);

            while (stk.Count > 0)
            {
                Position cur = stk.Pop();

                if (cur.depth == n - 1) return true;

                for (int i = 0; i < 12; i++)
                {
                    Position next;
                    next.x = cur.x + moveX[i];
                    next.y = cur.y + moveY[i];
                    next.depth = cur.depth + 1;

                    if (IsValid(next.x, next.y) && map[next.depth, next.y, next.x])
                    {
                        stk.Push(next);
                    }
                }
            }
            return false;
        }

        private bool IsValid(int x,int y)
        {
            if (x < 0) return false;
            if (x > 9) return false;
            if (y < 0) return false;
            if (y > 9) return false;
            return true;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();
            
            while (true)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                if (input.All(a => a == 0)) break;
                
                Position pos;
                pos.x = input[0];
                pos.y = input[1];
                pos.depth = -1;

                int n = int.Parse(Console.ReadLine());

                Puzzle pz = new Puzzle(n);

                input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                
                for(int i = 0; i < n; i++)
                {
                    int idx = i * 2;

                    pz.MakeMap(i, input[idx], input[idx + 1]);
                }

                sb.AppendLine(pz.Solve(pos) ? "OK" : "NA");
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10156
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

int d,g;
int mx[10]={0};
int mp[10][2];
int flag[10]={0};

int solve(int a){
  int ans=INF;
  if(a==d){
   
    ans=0;
    int sum=0;
    rep(i,d){
      if(flag[i]==1){
	sum+=mx[i];
	ans+=mp[i][0];
      }
    }
    //cout<<sum<<endl;
    if(sum<g){
      repn(i,d-1){
	if(flag[i]==0){
	  int num2=(g-sum+(100*(i+1))-1)/(100*(i+1));
	  if(num2<mp[i][0]){ans+=num2;sum+=num2*(100*(i+1));break;}
	  else break;
	}
      }
    }
    if(sum<g) return INF;
    else return ans;
  }
  flag[a]=1;
  ans=min(solve(a+1),ans);
  flag[a]=0;
  ans=min(solve(a+1),ans);
  return ans;
}
  


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  
  cin>>d>>g;
  
  rep(i,d){
    cin>>mp[i][0]>>mp[i][1];
    mx[i]=(100*mp[i][0]*(i+1))+mp[i][1];
  }
  cout<<solve(0)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <deque>
#include <iomanip>
#include <bitset>
#include <complex>
#include <sstream>
#include <algorithm>
#include <limits>
#include <cmath>
#include <utility>
#include <tuple>
using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr int mod = 1e9+7;
constexpr ld eps = 1e-10;
constexpr ld pi = acos(-1.0);

#define DUMP(a) cout << #a << ": " << (a) << endl


int main() {
    string s;
    cin >> s;
    int c_pos = -1, f_pos=-1;
    for(int i=0; i<s.size(); ++i) {
        if(s[i] == 'C') {
            c_pos = i;
            break;
        }
    }
    for(int i=s.size()-1; i>=0; --i) {
        if(s[i] == 'F') {
            f_pos = i;
            break;
        }
    }
    if(c_pos != -1 && f_pos != -1 && c_pos < f_pos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
#include<stdio.h>
typedef struct{
    int k;
    char mozi;
}card;
    
int main(){
    int i, j, m, min;
    card num[36], suit[36], temp;
     
    scanf("%d", &m);
    for(i = 0; i < m; i++){
        scanf(" %c%d", &num[i].mozi, &num[i].k);
        suit[i].mozi = num[i].mozi;
        suit[i].k = num[i].k;
    }
    
    for(i = 0; i < m; i++){
        for(j = m-1; j > i; j--){
            if(num[j].k < num[j-1].k){
                temp = num[j];
                num[j] = num[j-1];
                num[j-1] = temp;
            }
        }
    }
   
    for(i = 0; i < m-1; i++){
        printf("%c%d ",num[i].mozi, num[i].k);
    }
    printf("%c%d\nStable\n",num[i].mozi, num[i].k);
   
    for(i = 0; i < m-1; i++){
        min = i;
        for(j = i; j <= m-1; j++){
            if(suit[j].k < suit[min].k) min = j;
        }
        temp = suit[i];
        suit[i]=suit[min];
        suit[min]=temp;
    }
   
    for(i = 0; i < m-1; i++){
        printf("%c%d ",suit[i].mozi,suit[i].k);
    }
    printf("%c%d\n",suit[i].mozi,suit[i].k);
    
    for(i = 0; i < m; i++){
        if(suit[i].mozi != num[i].mozi) {
            printf("Not stable\n");
            break;
        }
    }
    if(i == m)printf("Stable\n");
    
    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int> > a(n,vector<int>(m));
	vector<int> b(m);
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int k = 0; k < m; k++) {
		cin >> b[k];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			c[i] = c[i] + a[i][j] * b[j];
		}
	}
	for (int i = 0; i < n; i++) {
		cout << c[i] << endl;
	}
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef pair<int, pair<int,int> > ppi;
const ll mod = 1e9+7;
const int maxn=1e5;
void pvec(vi v){
    for(auto x:v){
        cout << x << " ";
    }cout << endl;
}
ll gcd(ll x, ll y){
    if(y==0){
        return x;
    }else{
        return gcd(y, x%y);
    }
}

ll binpow(ll a, ll b) {
    if(b==0){
        return 1;
    }
    ll res = 1;
    ll tmp = binpow(a,b/2);
    res = (tmp*tmp)%mod;
    if(b%2==1){
        res = (res*a)%mod;
    }
    return res;
}


void solve(){
    int n,k; cin>>n>>k;
    vi a(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    int s=0;
    for(int i=0; i<k; i++){
        s+=a[i];
    }
    cout << s << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3520
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int H,W;
string s[30][30];
string tmp = "snuke";
bool flag;
int main()
{
	scanf("%d%d",&H,&W);
	flag = false;
	for(int i=1;i<=H;i++)
	{
	if(flag) break;
	for(int j=1;j<=W;j++)
	{
		cin>>s[i][j];
		//if(flag)continue;
		if(s[i][j] == tmp)
		{
			char y = j+'A'-1;
			int x = i;
			printf("%c%d",y,x);
			flag = true;
			break;
		}
	}
}
	return 0;
}

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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  printf("%c%c%c", toupper(s1[0]), toupper(s2[0]), toupper(s3[0]));
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int main()
{
	int Q=gi(),a,b,c,d,i,len,s,t,k,pre,uni;
	string ans;bool o;
	while (Q--) {
		a=gi(),b=gi(),c=gi(),d=gi();
		ans.clear();
		if (a==b)
			for (i=c;i<=d;i++)
				ans+=i&1?'A':'B';
		else {
			if (a>b) o=true,swap(a,b),c=a+b+1-c,d=a+b+1-d,swap(c,d);
			else o=false;
			k=(b+a)/(a+1);
			pre=uni=0;
			if ((b+a-1)/a==k) {
				uni=k+1;
				for (t=30;~t;t--)
					if (a>=(1<<t)&&(b+a-(1<<t)-((pre+(1<<t)-1)/k))/(a-(1<<t)+1)==k)
						a-=1<<t,pre|=1<<t;
				b-=(pre-1)/k;
				pre+=(pre-1)/k;
			}
			for (i=c;i<=d&&i<=pre;i++) ans+=i%uni?'A':'B';
			c-=pre,d-=pre;
			len=b-a*k;
			for (i=max(1,c);i<=d;i++)
				if (i<=len)
					ans+='B';
				else
					ans+=(i-len)%(k+1)==1?'A':'B';
			if (o) {
				for (i=0;i<ans.size();i++) ans[i]=ans[i]=='A'?'B':'A';
				reverse(ans.begin(),ans.end());
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] mtHeight = new int[10];
        
        for (int i = 0; i < 10; i++) {
            mtHeight[i] = scanner.nextInt();
        }
        Arrays.sort(mtHeight);

        for (int i = mtHeight.length-1; i >= 7; i--) {
            System.out.println(mtHeight[i]);
        }
    }
}

Measured memory_bytes: 17300
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 03/08/2020

from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007

n, d = iia()
count = 0
for i in range(n):
    a, b = iia()
    t = (pow(a, 2) + pow(b, 2)) ** 0.5
    if t <= d:
        count += 1
print(count)

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

int main(void) {
	int n, i;
	char s[101]= {0};

	scanf("%d", &n);
	scanf("%s", s);

	if(n%2 != 0){
		printf("No");
		return EXIT_SUCCESS;
	}

	for(i=0; i < n/2;i++){
		if(s[i] != s[i+n/2]){
			printf("No");
			return EXIT_SUCCESS;
		}
	}

	printf("Yes");

	return EXIT_SUCCESS;
}


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

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int count = 0;
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    for (int i = 0; i <= A; i++)
    {
        for (int j = 0; j <= B; j++)
        {
            for (int k = 0; k <= C; k++)
            {
                if (500 * i + 100 * j + 50 * k == X)
                {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
import math
n=int(input())
l=[]
l1=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append((x,y))
N=math.factorial(n)
c=itertools.permutations(l,n)
l=list(c)
for j in range(N):
    for k in range(n-1):
        d=math.sqrt((l[j][k][0]-l[j][k+1][0])**2+(l[j][k][1]-l[j][k+1][1])**2)
        l1.append(d)
print(sum(l1)/N)


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

#define ll long long
#define MAX 300005
#define pp pair<int,pair<int,int>>
#define pb push_back
#define mod 1000000007

using namespace std;

/*
 * author: Kruti_20
 */

ll power(ll x, ll y);

ll gcd(ll a, ll b);

ll dp[MAX];
ll tree[4 * MAX];

void update(int node, int start, int end, int pos, ll val) {
    if (start == end) tree[node] = val;
    else {
        int mid = (start + end) / 2;
        if (pos <= mid) update(2 * node, start, mid, pos, val);
        else update(2 * node + 1, mid + 1, end, pos, val);
        tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    }
}

ll query(int node, int start, int end, int l, int r) {
    if (l > end || r < start) return 0;
    if (l <= start && r >= end) return tree[node];
    int mid = (start + end) / 2;
    return max(query(2 * node, start, mid, l, r), query(2 * node + 1, mid + 1, end, l, r));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    ll h[n + 1], a[n + 1];
    for (int i = 1; i <= n; i++) cin >> h[i];
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
        ll val = query(1, 1, n, 0, h[i]-1);
        dp[h[i]] = max(dp[h[i]], val + a[i]);
        update(1, 1, n, h[i], dp[h[i]]);
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
    cout << ans;
    return 0;
}

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

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

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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC137.OneClue();
        }
    }

    class ABC137
    {
        public static void OneClue()
        {
            var num = Input.getIntArray();
            if(num[0]==1)
            {
                Console.Write(num[1]);
            }
            else
            {
                int a = num[1]-num[0]+1;
                int b = num[1]+num[0]-1;
                for(int i=a; i<=b; i++)
                {
                    if(i==b)
                    {
                        Console.Write(i);
                    } 
                    else
                    {
                        Console.Write(i+" ");
                    }                    
                } 
            }
        }
    }

 

    class Input
    {
        public static int getInt()
        {
            int i = int.Parse(Console.ReadLine());
            return i;
        }

        public static string getString()
        {
            string s = Console.ReadLine();
            return s;
        }
        public static int[] getIntArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] num = s.Select(x=>int.Parse(x)).ToArray();
            return num;
        }
        public static long[] getLongArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            long[] num = s.Select(x=>long.Parse(x)).ToArray();
            return num;
        }
    }
}


Measured memory_bytes: 13268
N, M, L = map(int,input().split())
MAX=99999999999
A=[]
B=[]
C=[]
D=[[MAX for _ in range(N)] for _ in range(N)]
F=[[MAX for _ in range(N)] for _ in range(N)]
s=[]
t=[]
 
for i in range(M):
    l=list(map(int,input().split()))
    A.append(l[0]-1)
    B.append(l[1]-1)
    C.append(l[2])
 
 
 
Q=int(input())
 
for i in range(Q):
    m=list(map(int,input().split()))
    s.append(m[0]-1)
    t.append(m[1]-1)
 
 
for i in range(M):
    if C[i]>L : continue
    D[A[i]][B[i]]=C[i]
    D[B[i]][A[i]]=C[i]
 
for i in range(N):  D[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (D[i][k]+D[k][j])<D[i][j] :
                D[i][j]=D[i][k]+D[k][j]
 
for i in range(N):
    for j in range(N):
        if i==j : continue
        if D[i][j]<=L: F[i][j]=1
 
 
for i in range(N):  F[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (F[i][k]+F[k][j])<F[i][j] :
                F[i][j]=F[i][k]+F[k][j]
 
 
for p in range(Q) :
    if F[s[p]][t[p]] < MAX :
        print(F[s[p]][t[p]]-1)
    else :
        print(-1)

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

const int INF = 1001001001;

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  --x; --y;
  vector<int> ans(n);
  rep(sv,n) {
    vector<int> dist(n, INF);
    queue<int> q;
    auto push = [&](int v, int d) {
      if (dist[v] != INF) return;
      dist[v] = d;
      q.push(v);
    };
    push(sv, 0);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      int d = dist[v];
      if (v-1 >= 0) push(v-1, d+1);
      if (v+1 < n) push(v+1, d+1);
      if (v == x) push(y, d+1);
      if (v == y) push(x, d+1);
    }
    rep(i,n) ans[dist[i]]++;
  }
  rep(i,n) ans[i] /= 2;
  for (int i = 1; i <= n-1; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main()
{
    long long n;
    scanf("%lld",&n);
    long long arr[n];
    int i;
    int currentidx=0,current_longest=-1,longest=-1,idx;

    for(i=0;i<n;i++){

        scanf("%lld",&arr[i]);

        if(i==0){
            currentidx = 0; current_longest++;

        }
        else{
            if(arr[i]<= arr[i-1])
                current_longest++;
            else{
                if(current_longest > longest){
                    idx = currentidx; longest = current_longest;
                }
                currentidx = i;
                current_longest=0;

            }
        }

    }

    if(current_longest > longest){
        idx = currentidx; longest = current_longest;
    }


    printf("%d",longest);

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main (){
	char a[12];
	char b[12];
	char c[12];
	scanf ("%s %s %s", &a, &b, &c);
	int k = strlen(a); 
	int t = strlen(b); 
	int f = strlen(c);
	if (a[k-1] == b[0] && b[t-1] == c[0]) {
		printf("YES\n");
	} else {
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pi 3.14159265358979323846
#define mm 1000000007
int main()
{
    IOS;
    ll a,b,c,d,e;
    cin>>a;
    if(a>=400 && a<=599) b=8;
    else if(a>=600 && a<=799) b=7;
    else if(a>=800 && a<=999) b=6;
    else if(a>=1000 && a<=1199) b=5; 
    else if(a>=1200 && a<=1399) b=4;
    else if(a>=1400 && a<=1599) b=3;
    else if(a>=1600 && a<=1799) b=2;
    else b=1;
    cout<<b<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;


long double A, B, H, M;

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

	CST(20);
	cin >> A >> B >> H >> M;

	long double a = (pi*2.0*(H*60.0+M)) / 720.0;
	long double b = (pi*2.0*M) / 60.0;
	if (b > a)swap(a, b);

	long double ans = sqrt(A*A + B * B - 2 * A*B*cos(a - b));

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main() {
	string str;
	cin >> str;
	bool same = true;
	for (size_t i = 0; i < str.length(); i++)
	{
		if (str[i] != str[0]) same = false;
	}
	if (same) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1000;
	for (char c = 'a'; c < 'a' + 26; c++)
	{
		ll cnt = 0;
		bool flag = true;
		string temp = str;
		while (flag && temp.length() > 1) {
			flag = false;
			for (size_t i = 0; i < temp.length() - 1; i++)
			{
				string n;
				if (temp[i] == c || temp[i + 1] == c) {
					temp[i] = c;
				}
				else {
					flag = true;
				}
			}
			temp = temp.substr(0, temp.length() - 1);
			cnt++;
		}
		ans = min(cnt, ans);
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long
using namespace std;

ll num, rest, ans;

int main()
{
  cin >> num;
  
  if ( num % 500 ) {
    ans = num / 500;
    ans *= 1000;
    num %= 500;
    ans += ( num - ( num % 5 ) );
  }
  else 
    ans = num * 2;
 
  cout << ans << "\n";
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n;
    cin >> n;
    cout << n * 180 - 360 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES  // M_PI等のフラグ
#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


void solve(){
    /*解説AC
    https://youtu.be/yLkJZXkB6D0?t=2549

    S個のoを考える
    ooooo...o
    これの間にしきりを入れる。例えばS=7なら、
    |ooo|oooo
    これは、数列[3,4]を表している。
    このように、oと|を使っていくつの数列を作れるか考える。
    なお、数列の値は10以上でも構わない。（S=16のとき、数列[3,13]でもOK）

    dp[i] := 最後に切った位置がiのときの、数列の数
    */
    int S;
    cin >> S;
    ll dp[2001] = {0};
    dp[0] = 1;

    for (int i=1; i<S+1; i++) {
        for (int j=0; j<(i-3)+1; j++) {
            dp[i] += dp[j];
            dp[i] %= MOD;
        }
    }

    cout << dp[S] << endl;
}


int main(int argc, char const *argv[]){
    solve();
    return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
using namespace std;
#define endl '\n'

using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long int n,i;
    string temp;
    set<string> x;
    cin >> n;
    for (i = 0; i < n;i++){
        cin >> temp;
        x.insert(temp);
    }
    cout << x.size();
    return 0;
}

Measured memory_bytes: 19200
import java.util.*;


public class Main{

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int x=sc.nextInt();
		int t=sc.nextInt();
		
		int k=0;
		
		if(n%x==0)k=n/x;
		else k=((n-n%x)/x)+1;
		
       System.out.println(k*t);

	

	
	}
}


Measured memory_bytes: 35696
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_size(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N;
  cin>>N;
  
  vector<int> X(N);
  for(int i=0;i<N;i++){
    cin>>X[i];
  }
  
  vector<int> Y(N);
  for(int i=0;i<N;i++){
    Y[i]=X[i];
  }
  sort(Y.begin(),Y.end());
  
  for(int i=0;i<N;i++){
    if(X[i]<=Y[N/2-1]){
      cout<<Y[N/2]<<endl;
    }
    else{
      cout<<Y[N/2-1]<<endl;
    }
  }
}

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

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

    long long ans = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if(i * j >= n)break;
            ans++;
        }
    }

    cout << ans << endl;
}

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int n, ans; cin >> n;

    for(int i = 1; i <= n; i*=2) ans = i;
    cout << ans;
}


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

int main(){
    ll n; ll m; cin >> n >> m;
    ll left = m%n + m/n;
    ll now = m/n;
    if(left%now == 0){
        cout << now << endl;
        return 0;
    }
    while(true){
        left += n-1;
        now--;
        if(left%now == 0){
            cout << now << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int H[100005];
vector<int> G[100005];


int main(){
  int N, M;
  cin >> N >> M;
  rep(i,N){
    cin >> H[i];
  }
  rep(i,M){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int ret = 0;
  rep(i,N){
    bool flg = true;
    rep(j,G[i].size()){
      if(H[i] <= H[G[i][j]]) flg = false;
    }
    if(flg) ret++;
  }

  cout << ret << endl;
  
  return 0;
}




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

bool dp[5000][5000];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    
    ll h,w,n;
    cin>>h>>w>>n;
    ll ans = 0;
    ll m = max(h,w);
    while(n>0){
        n -= m;
        ans++;
    }
    cout << ans << endl;
}

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

int w[101], v[101];

long long int h[101][100001];

long long int knapsack(int idx, int Maxw){
    //printf("kn yeah %d %d\n", idx, Maxw);
    if(Maxw<=0||idx<0){
        return 0;
    }

    if(h[idx][Maxw]==NULL){
        if(Maxw-w[idx]<0){
            h[idx][Maxw]= knapsack(idx-1, Maxw);
        }
        else{
            h[idx][Maxw]= max(knapsack(idx-1, Maxw), knapsack(idx-1, Maxw-w[idx])+v[idx]);
        }
    }
    return h[idx][Maxw];
    /*
    else if(Maxw-w[idx]<0){
        return knapsack(idx-1, Maxw);
    }
    else{
        return max(knapsack(idx-1, Maxw), knapsack(idx-1, Maxw-w[idx])+v[idx]);
    }*/
}

main(){
    int W, n;
    cin >> n >> W;
    int i;



    for(i=0;i<n;i++){
        cin >> w[i] >> v[i];
    }

    long long int r = knapsack(n-1, W);

    cout << r;
}


Measured memory_bytes: 78080
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007

using namespace std;

int main(void){
    // Your code here!
    string s;
    long long count = 0;
    
    cin >> s;
    for(int i = 0; i < 3; i++)
        if(s[i] == '1')
            count++;
            
    cout << count << endl;
    
    return 0;
}

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

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


    const int N = pow(10,5) + 15;
    bool f[N] = {};

    int i = 1;

    while(!f[n]){
        f[n] = true;
        n = (n % 2 == 0 ? n / 2 : 3 * n + 1);
        i++;
    }

    cout << i << endl;
}

Measured memory_bytes: 384
// ALDS1-3D.cpp
//

#include <iostream>
#include <stack>
#include <list>

using namespace std;

int main()
{
	stack<int> Pool_L;
	stack<int> Pool_R;
	list<int> List_L;
	list<int> List_R;
	string S;
	cin >> S;
	int counter = 0;
	int top = 0;
	int max = 0;
	int max_index = 0;
	// 分水嶺を求める　一番高い場所で一番右側
	for (unsigned int i = 0; i < S.length(); i++)
	{
		if (S.at(i) == '\\')
		{
			top--;
		}
		if (S.at(i) == '/')
		{
			top++;
		}
		if (top >= max)
		{
			max = top;
			max_index = i;
		}
	}
	// 左側から分水嶺まで調べる
	int wL = 0;
	int tmpL = 0;
	for (int i = 0; i <= max_index; i++)
	{
		if (S.at(i) == '\\') {
			Pool_L.push(i);
		}
		if (S.at(i) == '/' && Pool_L.size() > 0) {
			wL += i - Pool_L.top();
			Pool_L.pop();
		}
		if (Pool_L.size() == 0)
		{
			if (wL != tmpL)
			{
				counter++;
				//cout << "左から　wL=" << wL << endl;
				List_L.push_back(wL);
				tmpL = wL;
			}
		}
	}
	// 右側から分水嶺まで調べる
	int wR = 0;
	int tmpR = 0;
	for (int k = S.length() - 1; k > max_index; k--)
	{
		if (S.at(k) == '/') {
			Pool_R.push(k);
		}
		if (S.at(k) == '\\' && Pool_R.size() > 0) {
			wR += Pool_R.top() - k;
			Pool_R.pop();
		}
		if (Pool_R.size() == 0)
		{
			if (wR != tmpR)
			{
				counter++;
				//cout << "右から　wR=" << wR << endl;
				List_R.push_front(wR);
				tmpR = wR;
			}

		}
	}
	cout << wL + wR << endl;
	cout << counter;
	int size_of_List_L = List_L.size();
	int tmp = 0;
	int q = 0;
	for (int j = 0; j < size_of_List_L; j++)
	{
		q = List_L.front();
		List_L.pop_front();
		if (q != tmp)
		{
			cout <<" "<< q - tmp;
			tmp = q;
		}
	}
	if (List_R.size() > 0)
	{
		int tmp_R = List_R.front();
		//int tmp_R = 0;
		//List_R.pop_front();
		int size_of_List_R = List_R.size();
		int q_R = 0;

		for (int j = 0; j < size_of_List_R; j++)
		{
			q_R = List_R.front();
			List_R.pop_front();
			if (q_R != tmp_R) {
				cout <<" "<< tmp_R - q_R;
				tmp_R = q_R;
			}
			if (j == size_of_List_R - 1)
			{
				cout <<" "<< q_R << endl;
			}
		}
	}
	else {
		cout << endl;
	}
}
/*
	\\//
	\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\
*/


Measured memory_bytes: 3240
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 INT_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 INT_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<int>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
	ll n,i;

	cin>>n;

	string s[n],X;
	ll a[n];



	for(i=0;i<n;++i)
	{
		cin>>s[i]>>a[i];
	}

	cin>>X;

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


	++i;

	ll sum=0;
	for(i=i;i<n;++i)
	{
		sum+= a[i];
	}

	cout<<sum<<"\n";



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i=0;i<n;i++) {
    int t, x, y;
    cin >> t >> x >> y;
    int z = x +y;
    if ((t < z) || (t % 2 != z % 2) )  {
      cout << "No\n";
      return 0;
    } 
  }

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


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

int main()
{
long long x,k,d;
cin>>x>>k>>d;
long long absx;
absx=abs(x);

if(x==0)
    {
    if(k%2==1)cout <<d;
    else cout <<0;
    }

else
{
    if(absx<d)
    {
    if(k%2==1)cout<<abs(absx-d);
    else cout <<min(abs(absx-2*d),absx);
    }

else if(absx==d)
    {
    if(k%2==1)cout <<0;
    else cout <<absx;
    }

else
    {   
    long long ans =absx/d;
    if(ans>=k)cout <<absx-k*d;
    else 
    {//ansとkの偶奇
    if(ans%2==k%2)cout <<abs(absx-ans*d);
    else          cout <<abs(absx-(ans+1)*d);
    }
    
    
    }
    
}


}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n+1);
	vector<bool> b(n+1,false);
	rep(i,n) cin >> a[i+1];
	for(int i=1;i<=n;++i){
		if(i==a[i]) b[i]=true;
	}
	int ans=0;
	for(int i=1;i<=n;++i){
		if(i==n){
			if(b[n]) ans++;
			break;
		}
		if(b[i] && b[i+1]){
			ans++;
			b[i]=false;
			b[i+1]=false;
		}
		else if(b[i]){
			ans++;
			b[i]=false;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
using System;
using System.Linq;

namespace AtCoderContest
{
    class Program
    {
        static void Main()
        {
            var nStr = Console.ReadLine();
            var answer = nStr.Select(c => int.Parse(c.ToString())).Sum() % 9 == 0
                ? "Yes"
                : "No";
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 33344
#include<stdio.h>
int main()
{
    long long int h,n;
    scanf("%lld%lld",&h,&n);
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];

    }
    if((h-sum) >0)
    {
        printf("No\n");
    }
    else
        printf("Yes\n");












    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n;
long long f[100];
int main()
{
    cin >> n;
    f[0] = 2;
    f[1] = 1;
    for (int i = 2;i <= n;i++)
    {
        f[i] = f[i-1] + f[i-2];
    }
    cout << f[n] << endl;
    return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 1e14;

void Main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a - b) * (b - c) * (c - a) == 0) {
    if (a != b || b != c || c != a) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>



using namespace std;
int N,M,T,K,H,W,P[1000],ans,amari[10],t[200000],tsa[200000],ex;
bool point[301][301],link[301][301],xsw,zero;
char a[100][100],b[100000];
string A,B,C;


int abs(int x){
	if(x<0){
		return -x;
	}
	return x;
}

int min(int x,int y){
	if(x<y)return x;
	return y;
}
int max(int x,int y){
	if(x>y)return x;
	
	return y;
}

int main(){
	cin >>N>>T;
	ans=0;
	if(N>1){
	for(int i=0;i<N;i++){
		cin>>t[i];
		if(i>=1){
		tsa[i]=t[i]-t[i-1];
		}
	}
	ex=t[0];
	for(int i=1;i<N;i++){
		if(tsa[i]>T){
			ans+=t[i-1]-ex+T;
			ex=t[i];
		}
		if(i==N-1){
			if(ex!=t[N-1]){
				ans+=t[i]-ex+T;
			}else{
				ans+=T;
			}
		}
	}
	}else{
		ans=T;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define ll long long 

ll n;
ll a[100009];
ll b[100009];


ll solve(int idx) {
	if(idx == n)
		return 0;

	int ans = 0;
	ans += min(a[idx], b[idx]);
	b[idx] -= min(a[idx], b[idx]);
	if(b[idx] > 0) {
		ans += min(a[idx + 1], b[idx]);
		a[idx + 1] -= min(a[idx + 1], b[idx]);
	}
	return ans + solve(idx + 1);

	// ll ans = INT_MIN;

	// if(flag == 1) {
	// 	ll rem = a[idx] - min(a[idx], b[idx - 1]);
	// 	if(rem < 0) rem = 0;
	// 	ans = max(ans, min(rem, b[idx]) + solve(idx + 1, 0));
	// }
	// else {
	// 	ans = max(ans, min(a[idx], b[idx]) + solve(idx + 1, 0));
	// }
	// ans = max(ans, min(a[idx + 1], b[idx]) + solve(idx + 1, 1));
	// return ans;
}

int main() {
	cin>>n;
	for(int i = 0; i <= n; i++)
		cin>>a[i];
	for(int i = 0; i < n; i++)
		cin>>b[i];

	cout<<solve(0)<<endl;

}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  ll a;
  cin >> a;
  string s;
  cin >> s;
  if (a >= 3200)
    cout << s << endl;
  else
    cout << "red" << endl;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
a = []
for i in range(H):
    a.append(list(input()))

result = [[''] * W for i in range(H)]
cake_id = 0
no_ichigo_rows = []
for i in range(H):
    cake_id += 1
    ichigo_cnt_in_cake = 0
    for j in range(W):
        if a[i][j] == '#': # イチゴのあるマス
            if ichigo_cnt_in_cake == 1: # 次のイチゴが見つかったら、別のケーキに切り分ける
                cake_id += 1
            ichigo_cnt_in_cake = 1
        result[i][j] = str(cake_id)
        if (j == W - 1) and ichigo_cnt_in_cake == 0: # イチゴが1つも乗っていない行の場合
            no_ichigo_rows.append(i)
            cake_id -= 1

# イチゴが1つも乗っていない行は、上下のイチゴが乗っている行の切り方に合わせる
for no_ichigo_row in no_ichigo_rows:
    ichigo_exists_row = -1
    for i in range(no_ichigo_row + 1, H):
        if i not in no_ichigo_rows:
            ichigo_exists_row = i
            break
    if ichigo_exists_row == -1:
        for i in reversed(range(0, no_ichigo_row)):
            if i not in no_ichigo_rows:
                ichigo_exists_row = i
                break

    for j in range(W):
        result[no_ichigo_row][j] = result[ichigo_exists_row][j]

for i in range(H):
    print(" ".join(result[i]))


Measured memory_bytes: 10100
-- Generates the sequence of prime numbers.
-- Based on http://qiita.com/little_Haskeller/items/614a3ae20a517c19bb1f
primes :: Integral a => [a]
primes = map fromIntegral primes'
    where
        primes' = [2, 3, 5] ++ sieve2 5 7 (drop 2 primes')
        sieve2 m s (p : ps) = [n | n <- ns, gcd m n == 1] ++ sieve2 (m * p) (p * p) ps
            where ns = [x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4]]

numOfPrimes :: Int -> Int
numOfPrimes 1 = 0
numOfPrimes n = length $ takeWhile (<= n) primes

main :: IO ()
main = putStr . unlines . map show . map numOfPrimes . map read . lines =<< getContents

Measured memory_bytes: 13544
/* ex4_3
   masaaki52	*/

#include <stdio.h>

int calculate(int num1, int num2);//プロトタイプ宣言

int main(void){
  int west,east;
  scanf("%d %d",&west,&east);//west,eastに値を入力
  printf("%d\n",calculate(west,east));//calculate関数にwest,eastを代入し、積雪量を計算、結果を出力
  return 0;
}

int calculate(int num1, int num2){//関数の定義
  int diff,height;
  diff = num2 - num1;//差をとってdiffに代入
  height = diff*(diff + 1)/2 - num2;//東の塔の高さとnum2との差を取りheightに代入
  return height;//heightを返す
}

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

int main(){
  int a;
  int b;
  int c;
  cin >> a >> b >> c;
  if(a == 5 && b == 7 && c == 5){
    cout << "YES" << endl;
  }
  else if(a == 7 && b == 5 && c == 5){
    cout << "YES" << endl;
  }
  else if(a == 5 && b == 5 && c == 7){
    cout << "YES" << endl;
  }
    else{
      cout << "NO" << endl;
    }
}

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

int main(){
    vi a(4);
    rep(i,4)cin>>a[i];
    
    vi robot(102);
    rep(i,4){
        if(i%2==0)robot[a[i]]++;
        else robot[a[i]]--;
    }
    
    for(int i=1; i<=100; i++){
        robot[i] += robot[i-1];
    }
    
    sort(robot.begin(), robot.end());
    int itr = robot.end() - lower_bound(robot.begin(), robot.end(), 2);
    
    cout << itr << endl;
    
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
class UnionFind{
	public:
	vi parent;
	vi dist;
	UnionFind(int x=1){
		parent=vi(x,-1);
		dist=vi(x);
	}
	int find(int x){
		if(parent[x]<0)return x;
		int r=find(parent[x]);
		dist[x]+=dist[parent[x]];
		return parent[x]=r;
	}
	Def depth(int x){
		find(x);
		return dist[x];
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	int size(int x){
		return -parent[find(x)];
	}
	void unite(int x,int y,Def k=0){
		k+=depth(y);
		k-=depth(x);
		k*=-1;
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(size(x)<size(y)){
			swap(x,y);
			k*=-1;
		}
		parent[x]+=parent[y];
		parent[y]=x;
		dist[y]=k;
	}
	int diff(int x,int y){
		return depth(x)-depth(y);
	}
};
int main(){
	int n,q;
	cin>>n>>q;
	UnionFind uf(n);
	while(q--){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		if(uf.same(a,b)){
			if(uf.diff(a,b)!=c){
				cout<<"No"<<endl;
				return 0;
			}
		}else uf.unite(a,b,c);
	}
	cout<<"Yes"<<endl;
}



Measured memory_bytes: 1792
from collections import Counter
import math
n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
MAX = sum(v[:a]) / a
print(MAX)

c = Counter(v)
average_nums = []
for i in range(a, b + 1):
    t = sum(v[:i]) / i
    if t >= MAX:
        average_nums.append(Counter(v[:i]))

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0
for num in average_nums:
    multi = 1
    for k, v in num.items():
        multi = multi * nCr(c[k], v)
    ans += multi
print(ans)

Measured memory_bytes: 39664