akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'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'};
//vc Alp ={'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'};
//cout<<""<<endl;

int main(){
  int N;cin>>N;
  N %=10;
  if(N==0 ||N==1||N==6||N==8 )cout<<"pon"<<endl;
  else if(N==3)cout<<"bon"<<endl;
  else cout<<"hon"<<endl;
  

}






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

const int N= 3e5+5;
int R[N];
void solve() {
   int k,n;
   scanf("%d%d",&k,&n);
   if(k==1) {
      int x = (n+1)/2;
      for(int i=0;i<x;++i) {
         printf("%d ", 1);
      }
      return;
   } else if(k%2==0) {
      printf("%d ", k/2);
      for(int i=0;i<n-1;++i) {
         printf("%d ", k);
      }
      return;
   } else {
      for(int i=0;i<n;++i) {
         R[i] = (k+1)/2;
      }
      int pos = n-1;
      int diff = n/2;

      while(diff--) {
         --R[pos];
         if(R[pos]==0) {
            --pos;
         } else {
            for(int j = pos+1;j<n;++j) {
               R[j] = k;
            }
            pos = n-1;
         }
      }
      for(int i=0;i<=pos;++i) {
         printf("%d ", R[i]);
      }
      putchar('\n');
   }
}
int main() {
   //freopen("input.txt","r",stdin);
   solve();
}

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

using namespace std;

long long int numof(long long int a,long long int b,long long int c){
    
     return (b/c) - (a/c) + (a%c==0);
    
}


int main() {
    long long int a,b,c,d;
     cin >> a >> b >> c >> d;
   // cout << numof(a,b,c) <<" "<< numof(a,b,d)<<" "<<numof(a,b,(c*d)/__gcd(c,d))<<' ';
    cout << b-a + 1 -(numof(a,b,c) + numof(a,b,d)-numof(a,b,(c*d)/__gcd(c,d)));
}

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

int N, m;

int main() {
	cin >> N >> m;
	
	typedef pair< int, int > pii;
	set< pii > interval;
	
	for (int i=0; i<m; ++i) {
		int c, d;
		cin >> c >> d;
		
		// left side
		auto it = interval.lower_bound(pii(c, 0));
		if (it != interval.begin()) {
			--it;
			if (c <= (*it).second) {
				c = (*it).first;
				d = max(d, (*it).second);
				interval.erase(it);
			}
		}
		
		// right side
		it = interval.lower_bound(pii(c, 0));
		if (it != interval.end()) {
			if (c <= (*it).first && (*it).first <= d) {
				d = max(d, (*it).second);
				interval.erase(it);
			}
		}
		
		interval.insert(pii(c, d));
	}
	
	int ans = N+1;
	for (pii p : interval) {
		int len = p.second - p.first;
		ans += 2 * len;
	}
	cout << ans << endl;
}


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

int mx;
string s;

int solve(int indx) {
	bool mark[2][26] = {};
	for (int i = 0; i < indx; i++)
		mark[0][s[i] - 'a']++;
	for (int i = indx; i < s.size(); i++)
		mark[1][s[i] - 'a']++;
	
	int res = 0;
	for (int i = 0; i < 26; i++)
		if (mark[0][i] && mark[1][i])
			res++;
	return res;
}

int main() {
	cin >> s >> s;
	for (int i = 1; i < (int)s.size(); i++)
		mx = max(mx, solve(i));
	cout << mx;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <iomanip>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    cout << fixed << setprecision(20);
    double l;
    cin >> l;
    cout << pow(l / 3., 3) << endl;

    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/search/volumes/0298>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
void solve(){
    vector<ll> time;
    ll N;
    cin >> N;
    while(N--){
        ll h,m; cin >> h >> m;
        time.push_back(60*h+m);
    }
    cin >> N;
    while(N--){
        ll h,m; cin >> h >> m;
        time.push_back(60*h+m);
    }
    sort(time.begin(),time.end());
    time.erase(unique(time.begin(),time.end()),time.end());
    for(int i = 0; i < time.size();i++){
        cout << time[i]/60 << ":";
        if(time[i]%60 < 10) cout << "0" << time[i]%60;
        else cout << time[i]%60;
        if(i != time.size()-1) cout << " ";
        else cout << endl;
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e5;

int main()
{
	lld n,k;

	pair<lld,lld> p[MAXN];

	scanf("%lld %lld",&n,&k);
	for(int i = 0; i < n; i++)
	{
		lld a,b;
		scanf("%lld %lld",&a,&b);
		p[i].first = a;
		p[i].second = b;
	}

	sort(p,p+n);
	lld cnt = 0;

	for(int i = 0; i < n; i++)
	{
		cnt += p[i].second;
		if (cnt >= k)
		{
			printf("%lld\n", p[i].first);
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1792
N=int(input())
ans=0
for i in range(1,N+1):
  ans+=N*(N+1)//2-i*(i-1)//2-i*(N-i+1)+(N-i+1)
for i in range(N-1):
  u,v=map(int,input().split())
  l=min(u,v)
  r=max(u,v)
  ans-=l*(N-r+1)
print(ans)

Measured memory_bytes: 69772
import java.util.*;
import java.io.*;

public class Main {

	public static void main (String[] args) {
	   InputReader in = new InputReader(System.in);
	   int a = in.readInt();
	   int b = in.readInt(); 
	   int c = in.readInt();
	   int max = Math.max(a, Math.max(c, b)); 
	   System.out.println((3*max % 2 == (a+b+c)%2) ? (3*max - (a+b+c))/2:(3*(max+1) - (a+b+c))/2); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   int h , w;
   cin >> h >> w;
   vector<string> str(h*w);
	for (int i = 0; i < (h*w); i++) cin >> str.at(i);
  	for (int i = 0; i < (w+2); i++){
      cout << '#';
      if (i==(w+1)) cout << endl;
    }
    for (int i = 0; i < h ; i++){
      cout << '#' ;
      cout << str.at(i);
      cout << '#' << endl;
    }
  	for (int i = 0; i < (w+2); i++){
      cout << '#';
      if (i==(w+1)) cout << endl;
    }
}

Measured memory_bytes: 384
using System;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var length = input.Length - 2;
            string ans = input[0] + length.ToString() + input[input.Length - 1];
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 25928
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();

    System.out.println((1900 * M + 100 * (N - M)) * (1 << M));
  }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef COMPETITIVE_PROGRAMMING_LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) if(0){}
#endif


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

  ll ans = n*(n+1) - 1; // [1,n] for all n numbers, then subtract 1 because for 1 we only have {1} not {1,1}
  for (ll k = 2; k <= n/2; ++k) {
    for (int i = 2; i*k <= n; ++i) {
      ans += i*k;
    }
  }
  cout << ans << endl;

}



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

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define P 1000000007
#define N 310
int n;
int C[N][N];
int P2[N];

void gcd(int a,int b,int &x,int &y) {
  if(b==0){x=1,y=0;return;}
  gcd(b,a%b,y,x),y-=a/b*x;
}
int inv(int n) {
  int x,y;gcd(n,P,x,y);
  if(x<0)x+=P;return x;
}

ll f[N][N];

ll ff(int m, int r) {
	if (r < 0) return 0;
	if (r > m) return 0;
	if (m == 0) return 1;
	if (f[m][r] != -1) return f[m][r];
	ll S = 0;
	// Case 1: last is in
	
	ll T1 = 0;
	T1 = ff(m-1, r);
	T1 = (ll)T1 * P2[r]%P;
	
	// Case 2: last is not in
	ll T2 = 0;
	T2 = ff(m-1,r-1);
	ll C = P2[n] - P2[r-1];
	if (C < 0) C += P;
	T2 = (ll)T2 * C %P;
	//cout << m << " " << r << " " << T1 << " " << T2 << endl;
	
	S = (T1 + T2)%P;
	
	f[m][r] = S;
	return S;
}

ll gg(int n, int m) {
	if (m > n) return 0;
	ll S = 1;
	for (int i = 0; i < m; i ++) {
		ll T = P2[n] - P2[i];
		if (T < 0) T += P;
		S = (ll)S*T%P;
	}
	for (int i = 0; i < m; i ++) {
		ll T = P2[m] - P2[i];
		if (T < 0) T += P;
		S = (ll)S*inv(T)%P;
	}
	return S;
}

int main () {
	P2[0] = 1;
	for (int i = 1; i < N; i ++) P2[i] = P2[i-1]*2%P;
	cin >> n;
	for (int i = 0; i < n; i ++)
		for (int j = 0; j < n; j ++)
			cin >> C[i][j];
	int nw = 0;
	for (int i = 0; i < n; i ++) {
		for (int j = i; j < n; j ++) {
			if (C[j][i]) {
				for (int k = 0; k < n; k ++)
					swap(C[nw][k], C[j][k]);
				break;
			}
		}
		if (!C[nw][i]) continue;
		for (int j = nw+1; j < n; j ++)
			if (C[j][i]) {
				for (int k = 0; k < n; k ++)
					C[j][k] ^= C[nw][k];
			}
		nw++;
	}
	//cout << nw << endl;
	for (int i = 0; i <= n; i ++)
		for (int j = 0; j <= n; j ++) f[i][j] = -1;
	ll S = 0;
	for (int rk = 0; rk <= n; rk ++) {
		ll T = ff(n, rk); // #mat with rk r
		ll T1 = gg(n, nw); // #nw subsp in n
		ll T2 = gg(rk, nw); // #nw subsp in rk
		ll TP = (ll) T2 * inv(T1)%P; // prob contain subsp
		T = (ll)T*TP%P;
		for (int i = 0; i < n; i ++) { // fixed
			T = (ll)T*P2[n-rk]%P;
		}
		/*
		for (int i = nw; i < n; i ++) { // any
			T = (ll)T*P2[n]%P;
		}
		*/
		(S += T) %= P;
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s; 
	for(int i=0;i<(int)s.size()-1;i++)
	{
		if(s[i]==s[i+1])
		{
			cout<<i+1<<" "<<i+2<<"\n";
			return 0;
		}
	} 
	for(int i=0;i<(int)s.size()-2;i++)
	{
		if(s[i]==s[i+2])
		{
			cout<<i+1<<" "<<i+3<<"\n";
			return 0;
		}
	}
	cout<<"-1 -1\n";
	return 0;
}

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


int main() {
	//cout << fixed << setprecision(10);
	long long int L[200000],R[200000],q,n,cou = 0, ax = 0, num[200000] = {};
	long long int dp[120][5][5][5] = {};
	dp[0][3][3][3] = 1;
	string str;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= 4; j++) {
			for (int k = 1; k <= 4; k++) {
				for (int p = 1; p <= 4; p++) {
					dp[i][p][j][3] += dp[i-1][k][p][j];
				}
			}
		}
		for (int j = 1; j <= 4; j++) {
			for (int k = 1; k <= 4; k++) {
				for (int p = 1; p <= 4; p++) {
					dp[i][p][j][1] += dp[i-1][k][p][j];
				}
			}
		}
		for (int j = 1; j <= 4; j++) {
			for (int k = 1; k <= 4; k++) {
				for (int p = 1; p <= 4; p++) {
					if (k == 1 && j == 4 || p == 1 && j == 4 || p == 4 && j == 1 || k == 1 && p == 4) { continue; }
					dp[i][p][j][2] += dp[i-1][k][p][j];
				}
			}
		}
		for (int j = 1; j <= 4; j++) {
			for (int k = 1; k <= 4; k++) {
				for (int p = 1; p <= 4; p++) {
					if (p==1&&j==2) { continue; }
					dp[i][p][j][4] += dp[i-1][k][p][j];
				}
			}
		}
		for (int j = 1; j <= 4; j++) {
			for (int p = 1; p <= 4; p++) {
				for (int r = 1; r <= 4; r++) {
					dp[i][p][j][r] %=1000000007;
				}
			}
			
		}
	}
	for (int j = 1; j <= 4; j++) {
		
			for (int p = 1; p <= 4; p++) {
				for (int r = 1; r <= 4; r++) {
					cou+=dp[n][p][j][r];
				}
			}
		
	}
	cout << cou % 1000000007;
}


Measured memory_bytes: 384
#include <cstdio>

typedef long long LL;

int main() {
	int Q, H, S, D; LL N;
	scanf("%d%d%d%d%lld", &Q, &H, &S, &D, &N);
	if (H > 2 * Q) H = 2 * Q;
	if (S > 2 * H) S = 2 * H;
	if (D > 2 * S) D = 2 * S;
	printf("%lld\n", N / 2 * D + N % 2 * S);
	return 0;
}

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define f first
#define s second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 2500;

int n, m, q, a[3][N][N];
char c[N][N];

int get(int tp, int xa, int ya, int xb, int yb){
	return a[tp][xb][yb] - a[tp][xb][ya - 1] - a[tp][xa - 1][yb] + a[tp][xa - 1][ya - 1];
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(5) << fixed;

	cin >> n >> m >> q;

	for(int i = 1; i <= n; ++i)
	for(int j = 1; j <= m; ++j){
		cin >> c[i][j];
		a[2][i][j] = (c[i][j] == '1');
		if(c[i][j] == c[i][j - 1] && c[i][j] == '1'){
			a[0][i][j] = 1;
		}
		if(c[i][j] == c[i - 1][j] && c[i][j] == '1'){
			a[1][i][j] = 1;
		}
		a[0][i][j] = a[0][i][j] + a[0][i - 1][j] + a[0][i][j - 1] - a[0][i - 1][j - 1];
		a[1][i][j] = a[1][i][j] + a[1][i - 1][j] + a[1][i][j - 1] - a[1][i - 1][j - 1];
		a[2][i][j] = a[2][i][j] + a[2][i - 1][j] + a[2][i][j - 1] - a[2][i - 1][j - 1];
	}	


	while(q--){
		int xa, xb, ya, yb;
		cin >> xa >> ya >> xb >> yb;
		cout << get(2, xa, ya, xb, yb) - get(1, xa + 1, ya, xb, yb) - get(0, xa, ya + 1, xb, yb) << endl;
	}
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}

Measured memory_bytes: 73472
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;

map<ll, ll> prime_factor(ll N)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= N; i++) {
        while(N % i == 0) {
            ++res[i];
            N /= i;
        }
    }
    if (N != 1) res[N] = 1;
    return res;
}

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

    map<ll, ll> resA = prime_factor(A);
    map<ll, ll> resB = prime_factor(B);
    
    ll cnt = 0;

    /*
    for (auto itrA = resA.begin(); itrA != resA.end(); itrA++) cout << itrA->first << endl;
    cout << endl;
    for (auto itrB = resB.begin(); itrB != resB.end(); itrB++) cout << itrB->first << endl;
    */

    for (auto itrA = resA.begin(); itrA != resA.end(); itrA++) {
        for (auto itrB = resB.begin(); itrB != resB.end(); itrB++) {
            if (itrA->first == itrB->first) cnt++;
        }
    }

    cout << cnt + 1 << endl;
    return 0;
}

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'


const lli mod = 1e9+7;
const int S = 2e5+5;
 
lli fact[S];
lli inv[S];

lli multi(lli x,lli n){
    if(n == 0)return 1;
    if(n==1)return x%mod;
    lli ans = multi((x*x)%mod,n/2);
    if(n%2)ans=(ans*x)%mod;
    return ans;
}

void precal()
{
  lli i;
  fact[0] = 1;
  inv[0] = multi(fact[0],mod-2);
  for(i=1;i<S;i++)
  {
    fact[i] = (i*fact[i-1])%mod;
    inv[i] = multi(fact[i],mod-2);
  }
}

lli ncr(lli x,lli y)
{
  if(x<y || x<0 || y<0)
    return 0;
  lli temp = fact[x];
  temp = (temp*inv[y])%mod;
  temp = (temp*inv[x-y])%mod;
  return temp;
}


int main()
{
    fastio;
    precal();
    int n,k;
    cin>>n>>k;
    lli ans = 0;
    lli mn = 0;
    lli mx = 0;
    lli l = 0, r = n;
    while(l < k){
        mn=mn+l;
        mx=mx+r;
        l++;
        r--;
    }

    lli old;

    while(l <= n+1){
        // cout<<mx<<' '<<mn<<" "<<old<<endl;
        ans = (ans+mx - mn + 1 + mod)%mod;
        old = mx;
        mn=mn+l;
        mx=mx+r;
        l++;
        r--;
    }
    cout<<ans<<endl;
}

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


int main(){
    int N;
    int ans=0;

    cin>>N;
    deque<int> slimes(N);

    int now,pre;

    cin>>pre;
    int continuous=1;

    for(int i = 1; i < N; i++)
    {
        cin>>now;

        if(pre==now){
            continuous++;
        }else{
            ans+=continuous/2;
            continuous=1;
        }

        pre=now;
    }
            ans+=continuous/2;
    

    cout<<ans<<endl;
}

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

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

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

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

const long long INF = 1LL << 60;


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

    vector<long long> h(n);
    vector<long long> dp(n);    

    rep(i, n) {
        cin >> h[i];
    }

    rep(i, n) {
        dp[i] = INF;
    }

    dp[0] = 0;

    rep(i, n) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) {
            chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }

    cout << dp[n - 1] << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
#include<algorithm>
#include<limits>

int infty = std::numeric_limits<int>::max();

int main(void){
	int V,E,s,t, d;
	scanf("%d %d",&V,&E);
	std::vector< std::vector<int> > A;
	A.resize(V);
	for (int i=0; i<V;i++){
		A[i].resize(V);
		for(int j=0; j<V; j++){
			if (i==j) A[i][j] = 0;
			else A[i][j] = infty;
		}
	}
	for(int i=0;i<E;i++){
		scanf("%d %d %d", &s, &t, &d);
		A[s][t] = d;
	}
	for(int k=0; k<V; k++){
		for(int i=0;i<V;i++){
			if(A[i][k] == infty) continue;
			for (int j=0;j<V;j++){
				if (A[k][j] != infty){
					A[i][j] = std::min(A[i][j], A[i][k]+A[k][j]);
				}
			}
		}
	}
	
	for(int i=0;i<V;i++){
		if(A[i][i]<0){
			printf("NEGATIVE CYCLE\n");
			return 0;
		}
	}
	for(int i=0;i<V;i++){
		for(int j=0;j<V;j++){
			if(A[i][j] == infty) printf("INF");
			else printf("%d", A[i][j]);
                        if(j!=V-1) printf(" ");
		}
		printf("\n");
	}
	return 0;

}

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

int main() {
  int N;
  cin >> N;
  string S;
  int P;

  vector<string> s(N);
  vector<int> p(N);

 

  for(int i = 0; i < N; i++) {
    cin >> s.at(i) >> p.at(i);
  }

  vector<string> copys(s);
   vector<int> copyp(p);

  bool flag = 1;
  for(int i = 0;flag; i++)  {
    flag = 0;
    for(int j = N - 1; j >= i + 1;j--) {
      if(p.at(j) > p.at(j - 1) ) {
        swap(p.at(j),p.at(j - 1));
        swap(s.at(j),s.at(j - 1));
        flag = 1;
      }
    }
  }

  flag = 1;

  for(int i = 0;flag; i++)  {
    flag = 0;
    for(int j = N - 1; j >= i + 1;j--) {
      if(s.at(j) < s.at(j - 1) ) {
        swap(p.at(j),p.at(j - 1));
        swap(s.at(j),s.at(j - 1));
        flag = 1;
      }
    }
  }




   for(int i = 0 ;i < N; i++) {
     for(int j = 0; j < N; j++) {
       if(s.at(i) == copys.at(j) && p.at(i) == copyp.at(j)) {
         cout << j + 1 << endl;
         break;
       }
     }
   }
  
}

Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    count = 0
    for i in range(N):
        if i % 2 == 0 and A[i] % 2 == 1:
            count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 61716
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
bool fl=true;
int h,w;
char s[53][53];
cin>>h>>w;
fr(i,h+2){
s[i][0]='.';
s[i][w+1]='.';
}
fr(i,w+2){
s[0][i]='.';
s[h+1][i]='.';
}
fr(i,h){
fr(j,w){
cin>>s[i+1][j+1];
}
}

fr(i,h){
if(fl==false) break;
fr(j,w){
if(s[i+1][j+1]=='#'){
fl=false;
if(s[i][j+1]=='#') fl=true;
else if(s[i+1][j]=='#') fl=true;
else if(s[i+1][j+2]=='#') fl=true;
else if(s[i+2][j+1]=='#') fl=true;
else break;
}
}
}
if(fl) cout<<"Yes";
else cout<<"No";

}

Measured memory_bytes: 256
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  $a = array_map('intval',explode(" ", trim(fgets(STDIN))));

  for($i=0;$i<$n;$i++){
    $a[$i] = abs($a[$i]);
  }
  echo max($a)-min($a);

Measured memory_bytes: 16220
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define do(x) for(int i = 1; i <= x; i++){ solve(); }
#define sz(x) (int)x.size()
#define pii pair < int, int >
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const ll MAXN = 1e9;
const ll SIZE = 5e4+2; //are u sure?
const ll mod = 1e9+7;

void solve(){
	string s, t; cin >> s >> t;
	cout << t << s << endl;
}


int main(){
	speedhack()
	// int it; cin >> it;
	int it = 1;
	do(it);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <functional>
#include <set>
#include <string>
#include <stdlib.h>
#include <utility>
 
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i = a;i<=b;i++)
#define ll long long int
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define iii pair<ii,int >
#define ff first
#define ss second
#define vi vector<int>
#define vc vector<char>
 
using namespace std;

vi g[300000];
int dp[300000];

void solve(int node){
	if(dp[node] != -1)return ;
	int mx = 0;
	FOR(i,g[node].size()){
		int child =g[node][i];
		solve(child);
		mx = max(mx,dp[child]);
	}
	dp[node] = 1+mx;
}

int main(){
	int H,W;
	cin >> H >> W;
	char grid[H][W];
	FOR(i,H){
		string s;
		cin >> s;
		FOR(j,W){
			grid[i][j] = s[j];
		}
	}
	int MOD = 1000000007;
	ll dp[H][W];
	FOR(i,H)FOR(j,W)dp[i][j] = 0;
	dp[0][0] = 1;
	if(grid[0][0] == '#' or grid[H][W] == '#'){
		cout << 0 << endl;
		return 0;
	}
	FOR(i,H){
		FOR(j,W){
			if(grid[i][j] == '#')continue;
			if(i > 0){
				dp[i][j] += dp[i-1][j];
			}
			if(j > 0)dp[i][j] += dp[i][j-1];
			dp[i][j] %= MOD;
			//cout << dp[i][j] << " ";
		}
		//cout << endl;
	}

	cout << dp[H-1][W-1] << endl;

	return 0;
}


Measured memory_bytes: 16128
H, W = map(int, input().split())

S = [['.']*(W+2)]

for i in range(H):
    s = input()
    S.append(['.'] + list(s) + ['.'])
    
S.append([['.']*(W+2)])

flag = True

for i in range(1, H):
    for j in range(1, W):
        if S[i][j]=='#':
            if S[i-1][j]!='#' and S[i][j-1]!='#' and S[i+1][j]!='#' and S[i][j+1]!='#':
                flag = False
                break
            
if flag:
    print("Yes")
else:
    print("No")

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

int main()
{
    int  n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];

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

    int mid = n / 2;
    if (n % 2 == 1 or d[mid] == d[mid - 1])
    {
        cout << 0 << endl;
        return 0;
    }

    int ans = d[mid] - d[mid - 1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}

int main(){
    INT(h,w);
    vector2d(int,magic,10,10);
    vector<int> wall(10,0);
    int x,z;
    in(magic);
    rep(y,h){
        rep(x,w){
            in(z);
            if(z>=0)wall[z]++;
        }
    }
    vector1d(int,ans,10,-1);
    ans[1]=0;
    queue<int> next;
    for(int i=0;i<10;i++){
        if(i==1)continue;
        vector1d(int,table,10,100000000);
        table[i]=0;
        next.push(i);
        while(!next.empty()){
            for(int j=0;j<10;j++){
                if(table[next.front()]+magic[next.front()][j]<table[j]){
                    next.push(j);
                    table[j]=table[next.front()]+magic[next.front()][j];
                }
            }
            next.pop();
        }
        ans[i]=table[1];
    }
    ll ans2=0;
    for(int i=0;i<10;i++){
        ans2+=(ll)wall[i]*ans[i];
    }
    out(ans2);
}

Measured memory_bytes: 3808
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<limits.h>

int main()
{
    long long int i,j,k,n,a[200000],x,t,b,count=0,sum=0 ;
    scanf("%lld",&n) ;
    for(i=0 ; i<n ; i++)
    {
        scanf("%lld",&a[i]) ;
    }
    for(i=0 ; i<n-1 ;i++)
    {
        if(a[i]>a[i+1])
        {
            sum=sum+a[i]-a[i+1]  ;


            a[i+1]=a[i] ;
        }
    }
    printf("%lld",sum) ;

}


Measured memory_bytes: 3272
#include <iostream>

using namespace std;

int main() {

	int a, b;

	while (cin >> a >> b, a != 0 && b != 0) {

		int dp[17][17] = { 0 };
		int n;

		cin >> n;

		dp[1][1] = 1;

		for (int i = 1; i <= n; i++) {
			int x, y;
			cin >> x >> y;
			dp[x][y] = -1;
		}

		for (int i = 1; i <= a; i++) {
			for (int j = 1; j <= b; j++) {

				if (dp[i][j] != -1) {
					if (j != 1 && dp[i][j - 1] != -1) {
						dp[i][j] += dp[i][j - 1];
					}

					if (i != 1 && dp[i - 1][j] != -1) {
						dp[i][j] += dp[i - 1][j];
					}
				}
			}
		}

		cout << dp[a][b] << endl;
	}

	return 0;

}


Measured memory_bytes: 3004
def solve(N, LR):
    mod = 998244353

    dp = [0]*(N+1)
    dp[1] = 1
    dpsum = [0]*(N+1)
    dpsum[1] = 1

    for i in range(2, N+1):
        for lr in LR:
            left = i - lr[1]
            right = i - lr[0]
            if right < 0:
                continue
            left = max(left, 0)
            dp[i] += (dpsum[right] - dpsum[left-1])
            dp[i] %= mod
        dpsum[i] = dpsum[i-1] + dp[i]
        dpsum[i] %= mod

    return dp[N]


if __name__ == "__main__":
    N, K = map(int, input().split())
    LR = [list(map(int, input().split())) for _ in range(K)]
    print(solve(N, LR))


Measured memory_bytes: 24552
def deltime(x):
    return (int((x+9)/10))*10

def subtime(x):
    return deltime(x)-x

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

sumtime=deltime(a)+deltime(b)+deltime(c)+deltime(d)+deltime(e)
sumtime -= max([subtime(a),subtime(b),subtime(c),subtime(d),subtime(e)])

print(sumtime)

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

const int MAXN = 1.1e5;
const int MAXM = 1.1e5;
int N, M;
pair<int, int> E[MAXM];

vector<pair<int, int>> adj[MAXN];
int outDeg[MAXN]; // just parity

bool vis[MAXN];
void dfs(int cur) {
	assert(!vis[cur]);
	vis[cur] = true;
	for (auto it : adj[cur]) {
		int nxt = it.first;
		int e = it.second;
		if (vis[nxt]) continue;
		dfs(nxt);
		if (outDeg[nxt]) {
			swap(E[e].first, E[e].second);
			outDeg[nxt] ^= 1;
			outDeg[cur] ^= 1;
		}
		assert(outDeg[nxt] == 0);
	}
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M;
	for (int e = 0; e < M; e++) {
		cin >> E[e].first >> E[e].second;
		E[e].first --, E[e].second --;
	}

	if (M % 2 == 1) {
		cout << -1 << '\n';
		exit(0);
	}

	for (int e = 0; e < M; e++) {
		int u, v; tie(u, v) = E[e];
		adj[u].emplace_back(v, e);
		adj[v].emplace_back(u, e);
		outDeg[u] ^= 1;
	}

	dfs(0);
	for (int e = 0; e < M; e++) {
		cout << E[e].first+1 << ' ' << E[e].second+1 << '\n';
	}

	return 0;
}


Measured memory_bytes: 13056
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a; string s; cin >> a >> s;
	if (a >= 3200)cout << s << endl;
	else cout << "red" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split(" ")))

c = 0
m = 0
for i in range(n - 1):
  if a[i] >= a[i + 1]:
    c += 1
  else:
    if c > m:
      m = c
    c = 0
  #print("{} {} {} {} {}".format(i, c, m, a[i], a[i + 1]))

print(max(c,m))

Measured memory_bytes: 14252
from collections import Counter
N, K = map(int, input().split())
A = list(map(int ,input().split()))

d = Counter(A)

d_ = sorted(d.items(), key=lambda x:x[1], reverse=True)
n =len(d_)
ans = 0
if n <= K:
    print(0)
    exit()
else:
    for i in range(K,n):
        ans += d_[i][1]
print(ans)

Measured memory_bytes: 43292
import java.util.*;


class Main{
  
      public static Long gcd(Long num1,Long num2) {
        if(num2==0) return num1;
        else return gcd(num2,num1%num2);
    }
  
  
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
      int[] a = new int[3];   
       for(int i=0;i<3;i++){
   		a[i] = sc.nextInt();
    }
      Arrays.sort(a);
      
      int ans = a[1] - a[0] + a[2] - a[1];
      System.out.println(ans);
	}
}


Measured memory_bytes: 35860
#include <stdio.h>
#include <string.h>
#define LEN 100000

typedef struct rr{
	char name[20];
	int t;
}round;

round R[LEN];
int head,tail,n;

void enqueue(round x){
	R[tail]=x;
	tail=(tail+1)%LEN;
}

round dequeue(){
	round x=R[head];
	head=(head+1)%LEN;
	return x;
}

int min(int a,int b){
	return a<b?a:b;
}

int main(){
	int elaps=0,c;
	int i,q;
	round u;
	scanf("%d %d",&n,&q);
	
	for(i=1;i<=n;i++){
		scanf("%s",R[i].name);
		scanf("%d",&R[i].t);
	}
	head=1;tail=n+1;
	while(head!=tail){
		u=dequeue();
		c=min(q,u.t);
		u.t-=c;
		elaps+=c;
		if(u.t>0){
			enqueue(u);
			}
			else {
				printf("%s %d\n",u.name,elaps);
			}
		}
	return 0;
	}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

int dp[3010][3010];

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

    rep(i, s.size()) {
        rep(j, t.size()) {
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);
            if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
        }
    }

    // 復元

    string ans = "";
    int i = (int) s.size(), j = (int) t.size();
    while (i > 0 && j > 0) {

        if (dp[i][j] == dp[i - 1][j]) {        // (i-1, j) -> (i, j) と更新されていた場合
            --i; // DP の遷移を遡る
        } else if (dp[i][j] == dp[i][j - 1]) { // (i, j-1) -> (i, j) と更新されていた場合
            --j; // DP の遷移を遡る
        } else {                               // (i-1, j-1) -> (i, j) と更新されていた場合
            // このとき s[i-1] == t[j-1] なのでt[j-1] + res でも OK
            ans = s[i - 1] + ans;
            --i, --j; // DP の遷移を遡る
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int a,b,c;
    cin >> a >> b >> c;
    cout << max(0,b+c-a) << endl;

}


Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int a ,b, temp, i;
    for(i=1; i<=3000; i++)
    {
        cin >> a >> b;
        if ( a == 0 && b == 0 )
            break;
            
        if(a > b)
        {
            temp = a;
            a = b;
            b = temp;
        }
        cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 3028
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,H=map(int,input().split())
    a,b=[0]*N,[0]*N
    for i in range(N):
        a[i],b[i]=map(int,input().split())
    b.sort(reverse=1)
    a.sort(reverse=1)
    ans=0
    for i in range(N):
        if b[i]<a[0]:
            break
        ans+=1
        H-=b[i]
        if H<=0:
            print(ans)
            exit()
    print(ans-(-H//a[0]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 43484
n,k = map(int,input().split())
A = list(map(int,input().split()))
result = 1000000001*15
def j_cost(cost):
    c = 1
    for i in range(1,len(A)):
        if(max(cost[:i]) < cost[i]):
            c += 1
    #print(c,cost)
    if c >= k:
        return True
    else:
        return False

for i in range(2**n):
    cost = [0]*len(A)
    for j in range(1,n):
        if((i>>j)&1):
            total = [x + y for (x,y) in zip(A[:j],cost[:j])]
            if(max(total)>=A[j]):
                cost[j] = max(total)+1-A[j]
            else:
                cost[j] = 0
    #print(cost,[x + y for (x,y) in zip(A,cost)])
    if(sum(cost) < result and j_cost([x + y for (x,y) in zip(A,cost)])):
        result = sum(cost)
print(result)


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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int A,B,M;
vector<int> a,b,c,x,y;

signed main()
{
    cin >> A>>B>>M;
    a.resize(A);
    b.resize(B);
    x.resize(M);
    y.resize(M);
    c.resize(M);
    rep(i,A){
        cin>> a[i];
    }
    rep(i,B){
        cin>>b[i];
    }
    rep(i,M){
        cin >>x[i]>>y[i]>>c[i];
    }
    int min_a = *min_element(a.begin(),a.end());
    int min_b = *min_element(b.begin(),b.end());

    int min_num = min_a + min_b;
  

    rep(i,M) {
        min_num = min(min_num,a[x[i]-1]+b[y[i]-1]-c[i]);
            }

    cout << min_num<<endl;


    return 0;
}


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

#define mod 1000000007
int dp[1005][1005];
string s[1005];

int main()
{
    int h,w;
    cin>>h>>w;
    
    for(int i=0;i<h;i++)
    {
       cin>>s[i];
    }
    
    dp[0][0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(s[i][j]=='#')
            {
                dp[i][j]=0;
                continue;
            }
            if(i>0)
            {
                dp[i][j]+=dp[i-1][j];
            }
            dp[i][j]%=mod;
            if(j>0)
            {
                dp[i][j]+=dp[i][j-1];
            }
            dp[i][j]%=mod;
        }
    }
    cout << dp[h-1][w-1];
    return 0;
}


Measured memory_bytes: 9464