akhauriyash/Code-Regression huggingface dataset:
# include <cstdio>
# include <algorithm>
# include <cmath>
# include <cstring>
# include <iostream>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if(b-a+1>=2019){
		cout<<"0";
		return 0;
	}
	int Min=2020;
	for(int i=a;i<=b;i++){
		for(int j=i+1;j<=b;j++){
			int x=i,y=j;
			Min=min((x%2019)*(y%2019)%2019,Min);
		}
	}
	cout<<Min;
	return 0;
}

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



int main()
{
    vector<int> c(27,0);
    int sum = 0;
    string s;cin>>s;
    for(int i = 0; i< 4; i++){
        c[s[i] - 'A']++;
    }
    for(int i = 0; i< 27; i++){
        if(c[i] == 2) sum++;
    
    }
    cout << (sum == 2? "Yes":"No") << endl;
    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
  string s, t; cin >> s >> t;
  cout << (s[0] == t[0]) + (s[1] == t[1]) + (s[2] == t[2]) << endl;
  return 0;
}



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

#define X first
#define Y second
#define pb push_back

using namespace std;

int t[100][100];
int ans[100][100][2];

int main() {
    ios_base::sync_with_stdio(false);

    int h, w, black = 0;;
    cin >> h >> w;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            char x;
            cin >> x;
            t[i][j] = (x == '.' ? 1 : 0);
            black += (x == '#');
        }
    }

    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            ans[i][j][1] = ans[i][j][0] = 100001;
        }
    }

    ans[1][1][1] = 0;
    int C = 3000;
    int lay = 0, prev = 1;
    while (C--)
    {
        for (int i = 1; i <= h; i++)
        {
            for (int j = 1; j <= w; j++)
            {
                if (!t[i][j]) continue;
                ans[i][j][lay] = min(ans[i][j][prev], ans[i][j][lay]);
                if (t[i + 1][j])
                    ans[i][j][lay] = min(ans[i + 1][j][prev] + 1, ans[i][j][lay]);

                if (t[i][j + 1])
                    ans[i][j][lay] = min(ans[i][j + 1][prev] + 1, ans[i][j][lay]);

                if (t[i - 1][j])
                    ans[i][j][lay] = min(ans[i - 1][j][prev] + 1, ans[i][j][lay]);

                if (t[i][j - 1])
                    ans[i][j][lay] = min(ans[i][j - 1][prev] + 1, ans[i][j][lay] );
            }
        }

        lay = 1 - lay;
        prev = 1 - prev;
    }
    if (ans[h][w][prev] == 100001)
        cout << -1;
    else
        cout << h*w - black - ans[h][w][prev] - 1;
    /*int c[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
            cin >> c[i][j];
    }
    int a[3];
    for (int i = 0; i < 3; i++)
        a[i] = c[i][i] / 2;
    bool ok = true;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
            ok &= (a[i] + a[j] == c[i][j]);
    }
    cout << (ok ? "Yes" : "No") << '\n';
    */return 0;
}


Measured memory_bytes: 384
# m 個のアルゴリズムを学びたい
# n 冊の参考書
# x 必要な理解度
n,m,x = map(int,input().split())
book = [list(map(int,input().split())) for _ in range(n)]
#n,m,x = 2,1,10
#book = [[1, 2, 2, 2], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10], [100, 10, 10, 10]]
#book = [[110,5],[100,5]]

def listadd(a,b,n):
  c = [0] * n
  for i in range(n):
    c[i] = a[i]+b[i]
  return c

ans = 0
for candi in range(0,2**n): # 読む本の候補リスト
  s = [0] * (m + 1)

  for i in range(n):
    #print(candi >> i & 1) 
    if candi >> i & 1:
      s = listadd(s,book[i],m+1)
  
  ck = 1
  for j in range(1,m+1):
    if s[j] < x:
      ck = 0
      break
    else:
      ck *= 1

  if ck:
    if ans:
      ans = min(ans,s[0])
    else:
      ans = s[0]

if ans:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 9232
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)


def read():
    H = int(input().strip())
    return H,


def solve(H):
    monsters = 1
    attacks = 0
    while H > 1:
        attacks += monsters
        H //= 2
        monsters *= 2
    attacks += monsters 
    return attacks


if __name__ == "__main__":
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 3060
def slove():
    import sys
    input = sys.stdin.readline
    s = [int(i) if i != "?" else -1 for i in list(str(input().rstrip('\n')))]
    ls = [[0] * 13 for _ in range(len(s))]
    mod = 10 ** 9 + 7
    for i in range(1):
        if s[-i-1] != -1:
            ls[i][s[-i-1] % 13] = 1
        else:
            for j in range(10):
                ls[i][j % 13] = 1
    for i in range(1, len(s)):
        mult = pow(10, i, 13)
        if s[-i-1] == -1:
            for j in range(10):
                for k in range(13):
                    ls[i][(mult * j + k) % 13] += ls[i-1][k]
                    ls[i][(mult * j + k) % 13] %= mod
        else:
            for k in range(13):
                ls[i][(mult * s[-i-1] + k) % 13] += ls[i-1][k]
                ls[i][(mult * s[-i-1] + k) % 13] %= mod
    print(ls[-1][5])


if __name__ == '__main__':
    slove()


Measured memory_bytes: 68216
#include <stdio.h>

main(){
  char data[4][4];
  int i, j, b, w;

  while(1){
    scanf("%c", &data[0][0]);
    if(data[0][0]=='0') break;
	 
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
	if(i==0 && j==0) continue;
	scanf("%c", &data[i][j]);
      }
      getchar();
    }

    b=w=0;

    for(i=0;i<3;i++){
      if(data[i][0]=='b' && data[i][1]=='b' && data[i][2]=='b') b=1;
      if(data[i][0]=='w' && data[i][1]=='w' && data[i][2]=='w') w=1;
      if(data[0][i]=='b' && data[1][i]=='b' && data[2][i]=='b') b=1;
      if(data[0][i]=='w' && data[1][i]=='w' && data[2][i]=='w') w=1;
    }
    if(data[0][0]=='b' && data[1][1]=='b' && data[2][2]=='b') b=1;
    if(data[0][0]=='w' && data[1][1]=='w' && data[2][2]=='w') w=1;
    if(data[0][2]=='b' && data[1][1]=='b' && data[2][0]=='b') b=1;
    if(data[0][2]=='w' && data[1][1]=='w' && data[2][0]=='w') w=1;

    if(b==1) printf("b\n");
    else if(w==1) printf("w\n");
    else printf("NA\n");
  }
  return 0;
}


    

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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N) for (int i = (init); i < (int)(N); i++)

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int N, M, P;
VI xs, ys;

int judge_one(VVVI &ts, int z0, int y0, int x0) {
    int c = ts[z0][y0][x0];
    if (c == 0) return 0;

    REP(dx, -1, 2) {
        REP(dy, -1, 2) {
            REP(dz, -1, 2) {
                if (!dx && !dy && !dz) continue;

                bool ok = true;
                rep(i, M) {
                    int x = x0 + i * dx;
                    int y = y0 + i * dy;
                    int z = z0 + i * dz;
                    
                    if (x < 0 || y < 0 || z < 0 || x >= N || y >= N || z >= N || ts[z][y][x] != c) {
                        ok = false;
                        break;
                    }
                }

                if (ok) {
                    return c;
                }
            }
        }
    }

    return 0;
}

int judge(VVVI &ts) {
    rep(z, N) rep(y, N) rep(x, N) {
        if (ts[z][y][x] == 0) continue;
        int res = judge_one(ts, z, y, x);
        if (res != 0) {
            return res;
        }
    }

    return 0;
}

void put(VVVI &ts, int x, int y, int c) {
    rep(z, N) {
        if (ts[z][y][x] == 0) {
            ts[z][y][x] = c;
            return;
        }
    }
}

PII solve() {
    VVVI ts(N, VVI(N, VI(N)));

    rep(i, P) {
        put(ts, xs[i], ys[i], i % 2 ? -1 : 1);

        int result = judge(ts);
        if (result != 0) {
            return MP(result, i + 1);
        }
    }

    return MP(0, 0);
}

int main(void) {
    while (cin >> N >> M >> P, N) {
        xs = VI(P);
        ys = VI(P);
        rep(i, P) {
            cin >> xs[i] >> ys[i];
            --xs[i];
            --ys[i];
        }

        PII ans = solve();

        if (ans.fst == 0) {
            cout << "Draw" << endl;
        } else {
            cout << (ans.fst == -1 ? "White" : "Black") << " " << ans.snd << endl;
        }
    }

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl
#define MOD 1000000007

ll calcNumOfCombination(ll n, ll r) {
  ll res;
  if(n<=1)res = 0;
  else res = n*(n-1)/2;
  return res;
}

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

  ll N,X,Y; cin>>N>>X>>Y;

  vector<ll> res(N);

  reps(i,1,N+1) reps(j, i+1, N+1) {
    ll dist = min(ll(j-i), abs(X-i)+abs(Y-j)+1);
    res[dist]++;
  }

  reps(i,1, N) cout << res[i] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int a[n][m]={};
    int k[n],c[m+1]={},counter=0;
    for(int i=0;i<n;i++)
    {
        cin>>k[i];
        for(int j=0;j<k[i];j++)
        {
            cin>>a[i][j];
            c[a[i][j]]++;
        }
    }
    for(int t=1;t<=m;t++)
    {
        if(c[t]==n)
        counter++;
    }
    cout<<counter<<endl;
    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b;
  cin >> a >> b;
  cout << (a + b) % 24 << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer, Integer> countMap = new HashMap<>();
        long sum = 0;
        for (int j=0; j<n; j++) {
            int a = sc.nextInt();
            sum += a;
            Integer count = countMap.get(a);
            if (count == null) {
                countMap.put(a, 1);
            } else {
                countMap.put(a, count+1);
            }
        }
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            int b = sc.nextInt();
            int c = sc.nextInt();

            long diffSum  = c-b;
            Integer fromCount = countMap.get(b);
            if (fromCount != null) {
                sum = sum + diffSum * fromCount;
                countMap.remove(b);
                Integer toCount = countMap.get(c);
                if (toCount == null) {
                    countMap.put(c, fromCount);
                } else {
                    countMap.put(c, toCount + fromCount);
                }
            }
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 68584
T = int(input())
for _ in range(T):
    N = int(input())
    A = [int(i) for i in input().split()]
    S = input()

    B = []
    ans = 0
    for a, s in zip(reversed(A), reversed(S)):
        for b in B:
            a = min(a, a ^ b)

        if a:
            if s == "1":
                ans = 1
                break
            else:
                B.append(a)

    print(ans)

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

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

	vector<int> A(N, 0);
	vector<int> B(100, 0);
	B[0] = N;

	while(1){
		REP(i, N) cout << (char)('a' + A[N - 1 - i]);
		cout << endl;
		if(A[0] == N - 1) break;
		REP(i, N){
			B[A[i]]--;
			A[i]++;
			B[A[i]]++;
			if(B[A[i] - 1] <= 0){
				B[A[i]]--;
				A[i] = 0;
				B[A[i]]++;
			}
			else{
				break;
			}
		}
	}



	return 0;
}


Measured memory_bytes: 1536
/**********************************************

1.
2.テァツつュテァツ板ーテゥツォツ佚ィツシツ?
3.sumita.takaki@gmail.com

last updated: 2013-07-10@17:33

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;


int main(void){


        while(1){

                int yen = 0;
                int oturi =0;
                int count = 0;

                cin >> yen;
                if(yen == 0)break;
                oturi = 1000 - yen;

                while(oturi/500 != 0){
                        oturi = oturi -500;
                        count++;        
                }
        

                while(oturi/100 != 0){
                        oturi = oturi -100;
                        count++;
                }
        

                while(oturi/50 != 0){
                        oturi = oturi -50;
                        count++;
                }
        

                while(oturi/10 != 0){
                        oturi = oturi -10;
                        count++;
                }
        

                while(oturi/5 != 0){
                        oturi = oturi -5;
                        count++;
                }
        

                count = count + oturi;        

                cout << count <<endl;

        }
    

        return 0;    


}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll s; cin >> s;

    ll a, b, c, d;
    a = 1e9; b = 1;

    // s = a * d - c
    d = ceil((double)s / (double)a);
    c = a * d - s;

    cout << "0 0 " << a << " " << b << " " << c << " " << d << endl;
}

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

#define ll long long
using namespace std;
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll p1;
	if(a%c==0)
	{
		p1=a;
	}
	else
	p1=a+c-(a%c);
	ll q1=b-(b%c);
	ll ans=0;
	ans+=(q1-p1)/c;
	if(a%d==0)
	{
		p1=a;
	}
	else
	p1=a+d-(a%d);
	
	q1=b-(b%d);
	ans+=(q1-p1)/d;
	ll gc=gcd(c,d);
	ll lc=c*d/gc;
	if(a%lc==0)
	{
		p1=a;
	}
	else
	p1=a+lc-(a%lc);
	q1=b-(b%lc);
	ans-=(q1-p1)/lc;
	cout<<(b-a)-ans<<endl;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;

int main(){
    fastio
  string h;
  cin>>h;
  string f=h.substr(0,4);
  string m=h.substr(5,2);
  string l=h.substr(8,2);
  if(stoi(f)<2019)
  cout<<"Heisei"<<endl;
  else if(stoi(f)<=2019 && stoi(m)<4)
  cout<<"Heisei"<<endl;
  else if(stoi(f)<=2019 && stoi(m)<=4 && stoi(l)<30)
  cout<<"Heisei"<<endl;
  else if(stoi(f)<=2019 && stoi(m)<=4 && stoi(l)<=30)
  cout<<"Heisei"<<endl;
  else cout<<"TBD"<<endl;
  
    return 0 ;
}

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

int main(){
    ll w, h, x, y; cin >> w >> h >> x >> y;

    cout << w * h / 2.0 << " " << (x + x == w and y + y == h) << endl;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define REP(i, a, b) for(long long i=a; i<=b; ++i)
#define REPN(i, a, b) for(long long i=a; i<=b; --i)
#define rep(i, a, b) for(long long i=a; i<b; ++i)
#define rep0(i,b) for(long long i=0; i<b; ++i)
#define REP0(i,b) for(long long i=0; i<=b; ++i)
#include<cmath>
#include <iomanip>
using namespace std;


typedef long long ll;

int MODE = 1e9+7;
ll prefix[403];
ll dp[403][403];
ll arr[403];
int n;


ll helper(int left, int right)
{
    if(left < 0 || right > n-1 || left > right || left == right)
    {

        return 0;
    }
    if(dp[left][right] != -1)
    {
        return dp[left][right];
    }

    ll minimum = 1e18+5;

    for(int i=left; i<right; ++i)
    {
        minimum = min(minimum, helper(left, i) + helper(i+1, right));

    }

    return dp[left][right] = minimum + prefix[right] - prefix[left-1];

}




int main()
{


    cin>>n;

    memset(dp, -1, sizeof(dp));

    rep0(i, n)
    {
        cin>>arr[i];
    }

    prefix[0] = 0;
    rep0(i, n+1)
    {
        prefix[i] = prefix[i-1] + arr[i];
    }


    cout<<helper(0 , n-1)<<endl;



    /*for(int i=0; i<n; ++i)
    {
        dp[i][i] = 0;
    }

    for(int i=n-2; i>=0; --i)
    {

        for(int j=i+1; j<n; ++j)
        {
            dp[i][j] = 1e18+5;
            ll s =  prefix[j] - prefix[i-1];
            for(int k = i; k<j; ++k)
            {
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s);
            }
        }
    }*/





    return 0;

}


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
//const int MOD = 998244353;

// Lib
//

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    ll N; cin >> N;
    ll ans = 0;
    for (ll r = 1; r*r <= N; ++r) {
        if ((N-r) % r == 0 && (N-r)/r > r){
            ans += (N-r)/r;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int a = sc.nextInt();
            int b = sc.nextInt();

            int diff = b - a;

            int ans = 0;
            for (int i = 1; i <= diff; i++) {
                ans += i;
            }
            ans -= b;

            System.out.println(ans);

        }
    }

}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <set>
using namespace std;

long long L, N;
vector<long long> X;

long long solve0(long long N, long long L, vector<long long> &X){
    vector<long long> Y(N+2, 0);
    for(long long i=1; i<=N; i++)
        Y[i] = Y[i-1] + X[i];

    long long ret = 0;
    for(long long i=1; i<N; i++){
        long long k = min(i, N-i);
        long long left = 2*(Y[i] - Y[i-k]);
        long long mid = L-X[i+1];
        long long right = 2*(-Y[i+k]+Y[i+1])+2*(k-1)*L;
        ret = max(ret, left+mid+right);
    }
    return ret;
}

long long solve1(long long N, long long L, vector<long long> &X){
    vector<long long> Y(N+2, 0);
    for(long long i=1; i<=N; i++)
        Y[i] = Y[i-1] + X[i];

    long long ret = 0;
    for(long long i=1; i<N; i++){
        long long k = min(i, N-i+1);
        long long left = X[i] + 2*(Y[i-1] - Y[i-k]);
        long long right = 2*(-Y[i+k-1]+Y[i])+2*(k-1)*L;
        ret = max(ret, left+right);
    }
    return ret;
}

int main(){
    cin >> L >> N;
    X.resize(N+2, 0);
    for(long long i=1; i<=N; i++)
        cin >> X[i];

    if(N == 1){
        cout << max(X[1], L-X[1]) << endl;
        return 0;
    }

    long long ans = 0;
    ans = max(ans, solve0(N, L, X));
    ans = max(ans, solve1(N, L, X));
    for(int i=1; i<=N; i++)
        X[i] = L - X[i];
    reverse(X.begin(), X.end());
    ans = max(ans, solve0(N, L, X));
    ans = max(ans, solve1(N, L, X));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3428
#include<stdio.h>
int  c[1000][1000];
int d[3][1001][1001];
int main(){
	int m,n,k;
	int i,j;
	char x;
	scanf("%d %d",&m,&n);
	scanf("%d",&k);
	for(i=0;i<m+1;i++)for(j=0;j<n+1;j++)for(int l=0;l<3;l++)d[l][i][j]=0;
	for(i=0;i<m;i++)for(j=0;j<n;j++){
		scanf(" %c",&x);
		if(x=='J')c[i+1][j+1]=0;
		if(x=='O')c[i+1][j+1]=1;
		if(x=='I')c[i+1][j+1]=2;
	}
	for(i=1;i<=m;i++)for(j=1;j<=n;j++){
		if(j==1)d[c[i][j]][i][j]=1;
		else{
			for(int l=0;l<3;l++){
				if(l==c[i][j])d[c[i][j]][i][j]=d[c[i][j]][i][j-1]+1;
				else d[l][i][j]=d[l][i][j-1];
			}
		}
	}
	for(i=1;i<=m;i++)for(j=1;j<=n;j++){
		for(int l=0;l<3;l++)d[l][i][j]=d[l][i-1][j]+d[l][i][j];
	}
	int ax,ay,bx,by;
	int ans1,ans2,ans3;
	for(i=0;i<k;i++){
		scanf("%d %d %d %d",&ay,&ax,&by,&bx);
		ans1=d[0][by][bx]-d[0][ay-1][bx]-d[0][by][ax-1]+d[0][ay-1][ax-1];
		ans2=d[1][by][bx]-d[1][ay-1][bx]-d[1][by][ax-1]+d[1][ay-1][ax-1];
		ans3=d[2][by][bx]-d[2][ay-1][bx]-d[2][by][ax-1]+d[2][ay-1][ax-1];
		printf("%d %d %d\n",ans1,ans2,ans3);
	}
	return 0;
}
		
	

Measured memory_bytes: 16640
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int num[] = new int[N];
      	boolean flag = true;
      	for(int i=0;i<N;i++){
          num[i] = sc.nextInt();
          if(num[i]%2 ==0){
            if((num[i]%3 != 0)&&(num[i]%5 != 0)){
              flag = false;
              System.out.println("DENIED");
              break;
            }
          }
          
        }
       if(flag==true){
       	System.out.println("APPROVED");
       }
    }
		
    }

Measured memory_bytes: 23124
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    vector<int> t(n-1);
    for(int i=0; i<n-1; ++i)
        cin >> t[i];

    vector<vector<int> > dp(1, vector<int>(2, 0));
    for(int i=0; i<n-1; ++i){
        vector<vector<int> > nextDp(min(i+2, n/2+2), vector<int>(2, INT_MAX/2));
        for(int j=0; j<min(i+1, n/2+1); ++j){
            nextDp[j+1][0] = dp[j][0];
            nextDp[j+1][1] = dp[j][0] + t[i];
            nextDp[j][0] = min(nextDp[j][0], dp[j][1] + t[i]);
            nextDp[j][1] = min(nextDp[j][1], dp[j][1]);
        }
        dp.swap(nextDp);
    }

    int ret = min(dp[n/2-1][0], dp[n/2][1]);
    cout << ret << endl;
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
// Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    Int n;
    cin >> n;
    string a, b, c;
    cin >> a >> b >> c;
    Int res = 0;
    for (Int i = 0; i < n; i++) {
        if ((a[i] == b[i] && a[i] != c[i]) || (b[i] == c[i] && b[i] != a[i]) || (c[i] == a[i] && c[i] != b[i])) {
            res += 1;
        }
        else if (a[i] != b[i] && b[i] != c[i] && c[i] != a[i]) {
            res += 2;
        }
    }
    dump(res);
    return 0;  
} 

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 P = pair<int, int>;
int main (void) {
    int A, B;
    cin >> A >> B;
    int tmp = B, c = 1;
    while (tmp >= 10) {
        tmp /= 10;
        c++;
    }
    int X =  pow(10, c) * A + B;
    rep(i, 317) {
        if (X == i * i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
} 


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

int main(void){
  char a[5];
  char b[] = "ABC";
  char c[] = "ARC";
  scanf("%s\n",a );
  if(strcmp(a,b) == 0) printf("%s\n", c);
  if(strcmp(a,c) == 0) printf("%s\n", b);
  return 0;
}

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

int main() {
  int a, b;
  int x, y;
  cin >> a >> b;
  
  x = a * b;
  y = x % 2;
  
 // cout << x << endl << y <<endl;
 
    if (y == 0){
      cout << "Even" << endl;
    }
    else {
      cout << "Odd" << endl;
    }
  }



Measured memory_bytes: 256
#include "stdio.h"
#include "string.h"

int main(void) {
  /* code */
  int n,m,p;
  int a = 0;
  int w = 0;
  int count[100001] = {0};
  scanf("%d %d",&n, &m);
  char s[3];
  for (int i = 0; i < m; i++) {
    scanf("%d %s", &p, s);
    if(count[p] != -1){
      if(strcmp(s,"AC")){
        count[p] += 1;
      }
      if(strcmp(s,"WA")){
        a +=1;
        w += count[p];
        count[p] = -1;
      }
    }
  }
/*
  for (int r = 0; r < N; r++) {
    // if (r == N-1){
    //   break;
    }
    for (int s = 0; s < N; s++) {
      if()
      if(strcmp(S[s],"WA")){
        wa += 1;
      }else if(strcmp(S[s],"AC")){
        ac+=1;
        break;
      }
    }
  }
  */
  printf("%d %d\n",a,w);
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define all(c) (c).begin(),(c).end()
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >
#define Inp(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define Out(a,n,ch) for(int i=0;i<n;i++)cout<<a[i]<<ch;cout<<endl;

int a[200005];
int32_t main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	
	int d,t,s;
	cin>>d>>t>>s;
	if(float(d)/s <=t)
		cout<<"Yes";
	else
		cout<<"No";

	
	return 0;
}


Measured memory_bytes: 3624
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main () {
    input! {
        n: usize,
    }
    let mut dp = vec![1e6 as i32; n+1];
    dp[0] = 0;
    for i in 1..n+1 {
        dp[i] = dp[i-1] + 1;
        {
            let mut x = 6;
            let y = x;
            while x <= i {
                dp[i] = cmp::min(dp[i], dp[i - x] + 1);
                x *= y;
            }
        }
        {
            let mut x = 9;
            let y = x;
            while x <= i {
                dp[i] = cmp::min(dp[i], dp[i - x] + 1);
                x *= y;
            }
        }
    }
    println!("{}", dp[n]);
}


Measured memory_bytes: 4352
n = int(input())
s = input()
from collections import Counter
c = Counter([i for i in s])
left_w = 0
right_e = c['E']
if s[0] == 'E':
    right_e -= 1

ans = left_w + right_e
for i in range(1, len(s)):
    if s[i-1] == 'W':
        left_w += 1
    if s[i] == 'E':
        right_e -= 1
    ans = min(ans, left_w+right_e)
print(ans)

Measured memory_bytes: 11724
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

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

int main()
{
    ll ans = 1,n,t;
    cin >> n;
    rep(i, n){
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void DispArg(int elem[], int num)
{
    int i;

    printf("%d", elem[0]);
    for (i = 1; i < num; i++) {
        printf(" %d", elem[i]);
    }
    printf("\n");

    return;
}

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

    scanf("%d", &num);
    for (i = 0; i < num; i++) {
        scanf("%d", &elem[i]);
    }

    DispArg(elem, num);

    for (i = 1; i < num; i++) {
        for (j = i; j > 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                break;
            }
        }
        DispArg(elem, num);
    }

    return 0;
}

Measured memory_bytes: 1032
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    String[] str1 = new String[N];
    String[] str2 = new String[M];
    for(int i = 0; i < N; i++){
      str1[i] = sc.next();
    }
    for(int i = 0; i < M; i++){
      str2[i] = sc.next();
    }
    for(int i = 0; i <= N - M; i++){
      for(int j = 0; j <= N - M; j++){
        boolean flag = true;
        for(int k = 0; k < M; k++){
          if(!str2[k].equals(str1[k+j].substring(i, i+M))){
            flag = false;
            break;
          }
        }
        if(flag){
          System.out.println("Yes");
          System.exit(0);
        }
      }
    }
    System.out.println("No");
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll N;
    cin>>N;
    cout<<(N/3)<<endl;
    return 0;
}

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

long long visited[5005], P[5005], C[5005];
vector<long long> X;

long long solve(int k)
{
    int sz = X.size();

    for (int i=1; i<sz; i++)
        X[i] += X[i-1];
    
    long long ans = - (long long) 1e18;
    long long rem = k % sz;
    long long pre = 1LL * (k / sz) * X.back();

    for (int i=0; i<sz; i++)
        ans = max(ans, X[i] - (i == 0 ? 0 : X[i-1]));
    
    if (k >= sz)
        ans = max(ans, pre);

    for (int i=0; i<sz; i++)
        for (int j=i; j<sz; j++)
        {
            long long curr;
            int len = j - i + 1;

            if (len <= rem)
                curr = max(0LL, pre);
            else
            {
                if (k < sz)
                    continue;
                
                curr = max(0LL, pre - X.back());
            }

            ans = max(ans, X[j] - (i == 0 ? 0 : X[i-1]) + curr);
        }
    
    for (int i=0; i<sz; i++)
        for (int j=i+1; j<sz; j++)
        {
            long long curr;
            int len = i + 1 + sz - j;

            if (len <= rem)
                curr = max(0LL, pre);
            else
            {
                if (k < sz)
                    continue;
                
                curr = max(0LL, pre - X.back());
            }

            ans = max(ans, X.back() - X[j-1] + X[i] + curr);
        }

    return ans;
}

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

    for (int i=1; i<=n; i++)
        cin >> P[i];
    
    for (int i=1; i<=n; i++)
        cin >> C[i];

    long long ans = - (long long) 1e18;
    
    for (int i=1; i<=n; i++)
    {
        if (visited[i])
            continue;
        
        int x = i;
        X.clear();

        while (!visited[x])
        {
            visited[x] = 1;
            X.push_back(C[x]);
            x = P[x];
        }

        ans = max(ans, solve(k));
    }

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


Measured memory_bytes: 3892
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n,k;
    cin >>n>>k;
    ll a[n];
    ll bef[n];//k-1回足す
    ll aft[n];//k回足す
    for(int i=0;i<n;i++){
        cin>>a[i];
        bef[i]=0;
        aft[i]=0;
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i>j){
                if(a[i]>a[j])bef[i]++;
            }//bef
            if(i<j){
                if(a[i]>a[j])aft[i]++;
            }//after
        }
    }
    //for(int i=0;i<n;i++){
    //    cout<<a[i]<<" "<<bef[i]<<" "<<aft[i]<<endl;
    //}
    for(int i=1;i<n;i++){
        bef[i]+=bef[i-1];
        aft[i]+=aft[i-1];
    }
    ans=(bef[n-1]*(k-1))%MAX;
    ans=(ans*k)%MAX;
    ll ans2=(aft[n-1]*k)%MAX;
    ans2=(ans2*(k+1))%MAX;
    ans=(ans+ans2)%MAX;
    ans=(ans*500000004)%MAX;
    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	constexpr int num = 11;
	
	while(true) {
		string S;
		int ans = 0;
		vector<vector<int>> r;
		
		cin>>S;
		
		if(S == "0") break;
		
		reverse(S.begin(), S.end());
		
		r.resize(2, vector<int>(num));
		
		
		for(int i = 0; i < S.size(); i++){
			int y = S[i] - '0';
			r[(i+1)%2][y]++;
			
			for(int j = 0; j < num; j++){
				int x = (j * 10 + y) % num;
				r[(i+1)%2][x] += r[(i)%2][j];
				r[(i)%2][j] = 0;
			}
			
			if(y) ans += r[(i+1)%2][0];
		}
		
		cout<<ans<<endl;
		// cout<<r[S.size()][0]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3268
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	string s;
	int ans=0;
	int i=0;
	cin>>s;
	sort(s.begin(),s.end());
	char c = 'a';
	while(i<s.length())
	{
		if(s[i]!=c)
		{
			cout<<c<<endl;
			return 0;
		}else{
			while(s[i]==c && i<s.length())
			{
				i++;
			}
		}
		c++;
	}
	if(i==s.length() && c-1=='z')
	{
		cout<<"None"<<endl;
	}else{
		cout<<c<<endl;
	}
	return 0;
}

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

P pattern(int x){
    int a;
    int b = x % 10;
    while(x){
        a = x;
        x /= 10;
    }
    return make_pair(a,b);
}

int main(){
    int N;
    cin >> N;
    map<pair<int,int>, int> m;
    for(int i = 1; i <= N; i++) m[pattern(i)]++;
    ll ans = 0;
    for(int i = 1; i <= N; i++) ans += m[make_pair(pattern(i).second, pattern(i).first)];
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    ll n;
    cin >> n;
    ll N = n;
    ll v[(ll)sqrt(n) + 5] = {};
    while(n%2 == 0) {
        v[2] ++;
        n /= 2;
    }
    for(ll i = 3; i<=sqrt(n); i = i+2) {
        while(n%i == 0) {
            v[i] ++;
            n /= i;
        }
    }
    ll ans = 0;
    if(n > 2) {
        //cout << 1 << '\n';
        ans ++;
    }

    for(ll i = 1; i<=sqrt(N); i++) {
        ll curr = v[i];
        ll sum = 0;
        ll now = 0;
        for(ll j = 1; j<=40; j++) {
            sum += j;
            if(sum > curr) {
                break;
            }
            else {
                now = j;
            }
        }
        ans += now;
    }
    cout << ans << '\n';
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 11448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll n;
    long double b;
    cin >> n >> b;
    ll ans = n * b;
    cout << ans << endl;
}


Measured memory_bytes: 3728
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define sz size()
#define vec vector<int>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, int now) {
	/*if (depth == n)return !now;
	for (int i = 0; i < k; i++) {
		if (dfs(depth + 1, now ^ t[depth][i]))return true;
	}
	/**/
	return false;
}



int main() {
	int a; cin >> a;
	str s; cin >> s;
	if (a < 3200)cout << "red" << endl;
	else cout << s << endl;



	return 0;
}

Measured memory_bytes: 256
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h = 0, w = 0; string s;
	cin >> h >> w;
	vector<vector<int> > dp(h, vector<int>(w, lim));
	pair<int, int> st;
	pair<int, int> en;
	cin >> st.fi >> st.se; --st.fi; --st.se;
	cin >> en.fi >> en.se; --en.fi; --en.se;
	for (int i = 0; i < h; ++i)
	{
		cin >> s;
		for (int j = 0; j < w; ++j)
			if (s[j] == '#')
				dp[i][j] = -1;
	}
	dp[st.fi][st.se] = 0;
	deque<pair<int, int> > dq;
	dq.eb(st.fi, st.se);
	while (!dq.empty())
	{
		pair<int, int> p = dq.front(); dq.pop_front();
		for (int i = -2; i <= 2; ++i)
			for (int j = -2; j <= 2; ++j)
			{
				if (p.fi + i >= 0 && p.fi + i < h && p.se + j >= 0 && p.se + j < w)
				{
					if (abs(i) + abs(j) == 1)
					{
						if (dp[p.fi + i][p.se + j] > dp[p.fi][p.se])
						{
							dp[p.fi + i][p.se + j] = dp[p.fi][p.se];
							dq.eb(p.fi + i, p.se + j);
						}
					}
					else if (dp[p.fi + i][p.se + j] > dp[p.fi][p.se] + 1)
					{
						dp[p.fi + i][p.se + j] = dp[p.fi][p.se] + 1;
						dq.eb(p.fi + i, p.se + j);
					}
				}
			}
	}
	if (dp[en.fi][en.se] == lim)
		dp[en.fi][en.se] = -1;
	cout << dp[en.fi][en.se] << endl;
}

Measured memory_bytes: 7644
#include <stdio.h>

int main( void ) {
	int i, n, sum;
	char ch[ 10 ][ 61 ] = { "", ".,!? .,!? .,!? .,!? .,!? .,!? .,!? .,!? .,!? .,!? .,!? .,!? ", "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc", "defdefdefdefdefdefdefdefdefdefdefdefdefdefdefdefdefdefdefdef", "ghighighighighighighighighighighighighighighighighighighighi", "jkljkljkljkljkljkljkljkljkljkljkljkljkljkljkljkljkljkljkljkl", "mnomnomnomnomnomnomnomnomnomnomnomnomnomnomnomnomnomnomnomno", "pqrspqrspqrspqrspqrspqrspqrspqrspqrspqrspqrspqrspqrspqrspqrs", "tuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuvtuv", "wxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyz" }, key, tmp;

	scanf( "%d%*c", &n );

	for ( i = 0; i < n; i++ ) {
		while ( 1 ) {
			scanf( "%c", &key );

			if ( key == '\n' )
				break;
			else if ( key == '0' )
				continue;

			for ( sum = 0; scanf( "%c", &tmp ), tmp != '0'; sum++ ) ;
			putchar( ch[ key - '0' ][ sum % 60 ] );
		}

		putchar( '\n' );
	}

	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

double cal(vector<int> x, vector<int> y, int p)
{
  double ret = 0;
  int n = x.size();
  for (int i = 0; i < n; ++i) {
    ret += pow(abs(x[i] - y[i]), p);
  }
  ret = pow(ret, 1.0 / p);
  return ret;
}

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<int> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &x[i]);
  }
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &y[i]);
  }
  double chev = -1;
  for (int i = 0; i < n; ++i) {
    chev = max(chev, 1.0 * abs(x[i] - y[i]));
  }
  double man = cal(x, y, 1);
  double euc = cal(x, y, 2);
  double tri = cal(x, y, 3);
  fprintf(stdout, "%.8lf\n", man);
  fprintf(stdout, "%.8lf\n", euc);
  fprintf(stdout, "%.8lf\n", tri);
  fprintf(stdout, "%.8lf\n", chev);
  return 0;
}

Measured memory_bytes: 1304
open System
open System.Collections.Generic


let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    stdin.ReadLine().Replace(","," ")
    |>stdout.WriteLine
    0


Measured memory_bytes: 11092
n,k = map(int,input().split())

if n == 0:
  print(0)
elif n % k==0:
  print(0)
elif n >k:
  while n > abs(n - k):
    n = min(abs(n - k),n % k)
  print(n)
else:
  while n > abs(n - k):
    n = abs(n - k)
  print(n)
  
    


Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    S = list(readline().rstrip().decode())
    for s in S[::2]:
        if s == 'L':
            print('No')
            return
    for s in S[1::2]:
        if s == 'R':
            print('No')
            return
    print('Yes')


if __name__ == '__main__':
    main()


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(m);
  vector<int> d(m);
  int i, j;
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
    cin >> b.at(i);
  }
  for(i = 0; i < m; i++)
  {
    cin >> c.at(i);
    cin >> d.at(i);
  }
  int min = 400000001;
  int checkpoint = -1;
  for(i = 0; i < n; i++)
  {
    for(j = 0; j < m; j++)
    {
      if((abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j))) < min)
      {
        checkpoint = j;
        min = abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
      }
    }
    cout << checkpoint+1 << endl;
    checkpoint = -1;
    min = 400000001;
  }
}

Measured memory_bytes: 256