akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
    int i,n,mod,flag=0;

    scanf("%d",&n);

    for(i=1; i<=3; i++)
    {
        mod=n%10;
        n=n/10;
        if(mod==7)
        {
            flag=1;
        }
    }
    if(flag==1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 1644
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 1000; i++) {
    if (floor(i * 0.08) == a && floor(i * 0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
   int N; cin >> N;
   vector<int> A(N),B(N),C(N);
   rep(i,N) cin >> A[i];
   rep(i,N) cin >> B[i];
   rep(i,N) cin >> C[i];
   sort(A.begin(),A.end());
   sort(B.begin(),B.end());
   sort(C.begin(),C.end());

   ll res = 0;

   rep(i,N){
      ll sum = 0;
      sum += (ll)(lower_bound(A.begin(),A.end(),B[i]) - A.begin());
      sum *= (ll)(C.end() - upper_bound(C.begin(),C.end(),B[i]));
      res += sum;
   }
   cout << res << endl;
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

int fact(int N) {
  if(N==0) return 1;
  int k = 1;
  srep(i,1,N+1) {
    k *= i;
  }
  return k;
}
  
int main() {
  int N;
  cin >> N;
  vi p(N),q(N);
  rep(i,N) {
    cin >> p[i];
  }
  rep(i,N) {
    cin >> q[i];
  }
  int a = 0;
  rep(i,N) {
    int c = p[i]-1;
    rep(j,i) {
      if(p[j]<p[i]) c--;
    }
    a += c * fact(N-i-1);
  }
  int b = 0;
  rep(i,N) {
    int c = q[i]-1;
    rep(j,i) {
      if(q[j]<q[i]) c--;
    }
    b += c * fact(N-i-1);
  }
  cout << abs(a-b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
long long n,m,i,j,s=0,t=2005,vis[2018],inq[2018],x,y,c,cnt;
long long cst,dis[2018];
struct ii
{
	long long y,z,d;
}e[1000005];
vector<long long> bi[2018];
void add(long long x,long long y,long long z,long long d)
{
	cnt++;
	bi[x].push_back(cnt+cnt-2);
	bi[y].push_back(cnt+cnt-1);
	e[cnt+cnt-2]=(ii){y,z,d};
	e[cnt+cnt-1]=(ii){x,0,-d}; 
}
bool bfs(long long s,long long t)
{
	queue<long long> qx;
	qx.push(s);
	memset(dis,0x3f,sizeof(dis));
	dis[s]=0;qx.push(s);
	while(!qx.empty()){
		long long x=qx.front();qx.pop();inq[x]=0;
		ff(bi[x],it){
			if(e[*it].z){
				long long y=e[*it].y,z=e[*it].d+dis[x];
				if(dis[y]>z){
					dis[y]=z;
					if(!inq[y]){
						inq[y]=1;
						qx.push(y);
					}
				}
			}
		}
	}
	return dis[t]<dis[t+1];
}
long long dfs(long long x,long long tt,long long flw)
{
	if(!flw)return 0;
	if(x==tt){
		vis[x]=1;
		return flw;
	}
	if(vis[x])return 0;
	vis[x]=1;
	long long ans=0;
	ff(bi[x],it){
		if(dis[x]+e[*it].d==dis[e[*it].y]&&e[*it].z){
			long long t=dfs(e[*it].y,tt,min(flw,e[*it].z));
			ans+=t;flw-=t;e[*it].z-=t;e[(*it)^1].z+=t;
			cst+=e[*it].d*t;
		}
		if(!flw)break;
	}
	return ans;
}
void dinic(long long s,long long t)
{
	while(bfs(s,t)){
		do{
			memset(vis,0,sizeof(vis));
			dfs(s,t,0x3f3f3f3f);
		}while(vis[t]);
	}
}
int main()
{
	scanf("%lld",&n);
	fz1(i,n){
		scanf("%lld%lld%lld",&x,&y,&c);
		add(s,i,c,0);
		add(i,2001,0x3f3f3f3f,x+y);
		add(i,2002,0x3f3f3f3f,-x+y);
		add(i,2003,0x3f3f3f3f,x-y);
		add(i,2004,0x3f3f3f3f,-x-y);
	}
	fz1(i,n){
		scanf("%lld%lld%lld",&x,&y,&c);
		add(i+n,t,c,0);
		add(2001,i+n,0x3f3f3f3f,-x-y);
		add(2002,i+n,0x3f3f3f3f,x-y);
		add(2003,i+n,0x3f3f3f3f,-x+y);
		add(2004,i+n,0x3f3f3f3f,x+y);
	}
	dinic(s,t);
	cout<<-cst<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	vector<int> a(3);
	int K, c = 0;
	cin >> a.at(0) >> a.at(1) >> a.at(2) >>  K;
	int maxi = 0;
	for (int i = 0; i < 3; i++) {
		if (maxi < a.at(i)){
			maxi = a.at(i);
			 		
		}
		c += a.at(i);
	}
	int ans = 1;
	for (int j = 1; j <= K; j++)
		ans = ans * 2;
	cout << c - maxi + maxi * ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int sum(int N){
    int k=0;
    for(int i=N-(N%4);i<=N;i++){
        k=k^i;
    }
    return k;
}


signed main(){
    int A,B;
    cin >> A >> B;
    int Ans=sum(A-1)^sum(B);
    //cout <<sum(A-1) << " " << sum(B) << endl;
    
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 384
N = int(input())

charList = [chr(i) for i in range(97, 97+26)]
ansStr = ""
while(True):
  amari = N % 26
  N = N//26
  if amari == 0:
    amari = 26
    N -= 1
  ansStr = charList[amari-1] + ansStr
  if N <= 0:
    break
print(ansStr)

Measured memory_bytes: 9084
#ABC149 B

#K>AのときはAは0になり、その残りをBから引く。
#それ以外のときはA-Kをする。Bはそのまま。

A,B,K=(int(i) for i in input().split())

if K>=A:
    if B>=(K-A):
        print(0,B-(K-A))
    else:
        print(0,0)
else:
    print(A-K,B)

Measured memory_bytes: 2940
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

#print(a)

score = [k - q ] * n
#print(score)
for i in range(q):
  score[ a[i]-1 ] += 1
  #print(score)
  
for i in range(n):
  print("Yes" if score[i] > 0 else "No")

Measured memory_bytes: 10540
#include <iostream>
using namespace std;
int main(void){
  
    int a,b,c;
    cin >> a >> b >> c;
    if (a <= b &&  b <= c){
        cout << a << " " << b << " " << c << endl;
        }
    else if (a >= b && a <= c){
        cout << b << " " << a << " " << c << endl;
        }
    else if (a <= c && c <= b){
       cout << a << " " << c << " " << b << endl;
        }
    else if (a >= c && a <= b){
        cout << c << " " << a << " " << b << endl;
        }
    else if (c >= b && c <= a){
        cout << b << " " << c << " " << a << endl;
        }
    else {
        cout << c << " " << b << " " << a << endl;
        }
    return 0;
}



Measured memory_bytes: 3052
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, 0, n)cin >> a[i];
	int cnt = 0, ans = 0;
	rep(i, 0, n-1) {
		if (a[i] >= a[i+1]) cnt++;
		else cnt = 0;
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int square(int x) {
  return x * x;
}

int main() {
  int n;
  cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  double ans = 0;
  for (int i = 0; i < n-1; i++) {
    for (int j = i+1; j < n; j++) {
      ans += sqrt(square(x[i]-x[j])+square(y[i]-y[j]));
    }
  }
  ans *= 4;
  ans /= n * 2;
  cout << fixed << setprecision(10) << ans << endl;
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define quicker ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;

int main()
{
    quicker
    #ifdef HALO
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t;
    cin >> t;
    int ans = (t / 500) * 1000 + ((t % 500) / 5) * 5;
    cout << ans;
  }

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int K;

int main() {

	cin >> K;

	ll ans = 0;

	rep(i, K) {
		rep(j, K) {
			rep(k, K) {
				ans += GCD(GCD(i + 1, j + 1), k + 1);
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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


int main(){
    ll A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;
    ll a = A,b = B,c = C,d = D,e =E;

    while(a % 10 != 0) if(a % 10 != 0) a++;
    while(b % 10 != 0) if(b % 10 != 0) b++;
    while(c % 10 != 0) if(c % 10 != 0) c++;
    while(d % 10 != 0) if(d % 10 != 0) d++;
    while(e % 10 != 0) if(e % 10 != 0) e++;
    
    ll ans1,ans2,ans3,ans4,ans5;
    ans1 = A + b + c + d + e;
    ans2 = a + B + c + d + e;
    ans3 = a + b + C + d + e;
    ans4 = a + b + c + D + e;
    ans5 = a + b + c + d + E;

    cout << min(ans1,min(ans2,min(ans3,min(ans4,ans5)))) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define MODU 33
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;
const pii eight_Dir[8] = { //?????????
	{ -1 ,1 },{ 0 ,1 },{ 1 ,1 },
	{ -1 ,0 },{ 1 ,0 },
	{ -1 ,-1 },{ 0 ,-1 },{ 1 ,-1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
int main() {
	int h, w;
	scanf("%d %d", &h, &w);
	vector<vector<int>> M(h, vector<int>(w)), dam(h, vector<int>(w));
	queue<pair<int,pii>> sara;
	REP(i, h) {
		scanf("%*c");
		REP(j, w) {
			scanf("%c", &M[i][j]);
			if (M[i][j] == '.') {
				sara.push({ 0,{i,j} });
				dam[i][j] = '.';
			}
			else M[i][j] -= '0';
		}
	}
	int ans = 0;
	while (sara.size()) {
		int turn = sara.front().first;
		pii pos = sara.front().second;
		sara.pop();
		REP(k, 8) {
			pii cur = { eight_Dir[k].first + pos.first ,eight_Dir[k].second + pos.second };
			if (Range(cur.first, 0, h - 1) && Range(cur.second, 0, w - 1)) {
				if (dam[cur.first][cur.second] != '.') {
					if ((++dam[cur.first][cur.second]) == M[cur.first][cur.second]) {
						dam[cur.first][cur.second] = '.';
						sara.push({ turn + 1, cur });
						ans = turn + 1;
					}
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 11112
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
using namespace std;

int main(){
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
    std::vector <int> N(4);
    std::string sin;
    cin >> sin;
    for(int i =0;i<4;i++){
        N[i]=std::stoi(sin.substr(i,1));
    }

    char s1,s2,s3;

    int S;
    int flag=0;

    for(int op1=0;op1<2;op1++){
        for(int op2=0;op2<2;op2++){
            for(int op3=0;op3<2;op3++){
                S=N[0];
                if(op1==0){
                    S+=N[1];
                    s1='+';
                }else{
                    S-=N[1];
                    s1='-';
                }
                if(op2==0){
                    S+=N[2];
                    s2='+';
                }else{
                    S-=N[2];
                    s2='-';
                }
                if(op3==0){
                    S+=N[3];
                    s3='+';
                }else{
                    S-=N[3];
                    s3='-';
                }
                if(S==7){
                    flag = 1;
                    break;
                }else{
                    continue;
                }
            }
            if(flag) break;
        }
        if(flag) break;
    }

    cout << N[0] << s1 << N[1] << s2 << N[2] << s3 << N[3] << "=7"<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#define ull unsigned long long
using namespace std;
const int nmax = 100100;
int N, cnt;
vector < pair < int , int > > v, v1;
bool used[nmax];
int main()
{
	cin >> N;
	for(int i = 0; i < N; ++i)
	{
		int x,y;
		cin >> x >> y;
		v.push_back(make_pair(x,y));
	}
	for(int i = 0; i < N; ++i)
	{
		int x,y;
		cin >> x >> y;
		v1.push_back(make_pair(x,y));
	}

	sort(v.begin(), v.end());
	sort(v1.begin(), v1.end());

	for(int i = 0; i < N; ++i)
	{
		int X = v1[i].first,Y=v1[i].second;
		int ind = -1;
		for(int j=0; j < N; ++j)
		{
			if(used[j]) continue;
			if(v[j].first < X && v[j].second < Y)
			{
				if(ind == -1)
					ind = j;
				else if(v[j].second > v[ind].second)
					ind = j;
			}
		}
		if(ind != -1)
			cnt++, used[ind]=1;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define ll long long
using namespace std;
int main(void){
    // Your code here!
    ll n,a,b,ans;
    cin>>n>>a>>b;
    ll count[3]={0};
    ll p[n];
    for(ll i=0;i<n;i++){
        cin>>p[i];
        if(p[i]<=a){
            count[0]++;
        }
        else if(p[i]<=b){
            count[1]++;
        }
        else{
            count[2]++;
        }
    }
    ans=min(count[0],count[1]);
    ans=min(ans,count[2]);
    cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

#define MAX_N 100000

int par[MAX_N]; // 親の番号
int node_rank[MAX_N];

// n要素で初期化
void init(int n){
  for(int i=0; i<n; i++){
    par[i] = i;
    node_rank[i] = 0;
  }
}
// 木の根を求める
int root(int x){
  if(par[x] == x){ // 根
    return x;
  } else {
    return par[x] = root(par[x]); // 経路圧縮
  }
}

// xとyが同じ集合に属するか否か
bool same(int x, int y){
  return root(x) == root(y);
}

// xとyの属する集合を併合
void unite(int x, int y){
  x = root(x);
  y = root(y);
  if(x == y) return;

  if(node_rank[x] < node_rank[y]){
    par[x] = y;
  } else {
    par[y] = x;
    if(node_rank[x] == node_rank[y])
      node_rank[x]++;
  }
}

struct data{
  int n;
  ll x;
  ll y;
};
struct edge{
  int p;
  int q;
  ll cost;
};

bool compx(data d1, data d2){
  return d1.x < d2.x;
}
bool compy(data d1, data d2){
  return d1.y < d2.y;
}
bool compe(edge e1, edge e2){
  return e1.cost < e2.cost;
}

int main(){
  int N;
  cin >> N;
  vector<data> Dx, Dy;

  for(int i=0; i<N; i++){
    ll x, y;
    cin >> x >> y;
    data dtmp = {i, x, y};
    Dx.push_back(dtmp);
    Dy.push_back(dtmp);
  }
  sort(Dx.begin(), Dx.end(), compx);
  sort(Dy.begin(), Dy.end(), compy);

  // cout << endl;
  // for(int i=0; i<Dx.size(); i++)
  //   cout << Dx[i].x << ' ' << Dx[i].y << endl;
  // cout << endl;
  // cout << endl;
  // for(int i=0; i<Dy.size(); i++)
  //   cout << Dy[i].x << ' ' << Dy[i].y << endl;
  // cout << endl;

  vector<edge> E;
  for(int i=0; i<N-1; i++){
    edge etmpx = {Dx[i].n, Dx[i+1].n, Dx[i+1].x - Dx[i].x};
    edge etmpy = {Dy[i].n, Dy[i+1].n, Dy[i+1].y - Dy[i].y};
    E.push_back(etmpx);
    E.push_back(etmpy);
  }
  sort(E.begin(), E.end(), compe);

  init(N);
  ll ans = 0;
  for(int i=0; i<2*(N-1); i++){
    // cout << E[i].p << ' ' << E[i].q << ' ' << E[i].cost;
    edge e = E[i];
    if(!same(e.p, e.q)){
      ans += e.cost;
      unite(e.p, e.q);
      // cout << " o" << endl;
    } else {
      // cout << " x" << endl;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13732
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int fg[110][110];
int line[1000000];
int main()
{
	int H,W;
	scanf("%d %d",&H,&W);
	int N;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
		scanf("%d",&line[i]);
	int nowrow=0;
	int nowrow_location=0;
	for(int i=N-1;i>=0;i--)
	{
		int cl=line[i];
		while(cl>=1)
		{
			if(nowrow_location==W && nowrow%2==0)
			{
				nowrow++;
				nowrow_location=W-1;
			}
			if(nowrow_location==-1 && nowrow%2==1)
			{
				nowrow++;
				nowrow_location=0;
			}
			fg[nowrow][nowrow_location]=i+1;
			if(nowrow%2==0)
				nowrow_location++;
			else
				nowrow_location--;
			cl--;	
		}
	}
	for(int i=0;i<H;i++)
	{
		for(int k=0;k<W;k++)
		{
			if(k!=0)
				printf(" ");
			printf("%d",fg[i][k]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main() {

   int k;
   cin >> k;
   string s;
   for (int i = 0; i < k; i++) s += "ACL";
   cout << s << endl;

   return 0;
}



Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
using namespace std;

typedef long long ll;
ll mod = 1000000007;

void bfs(int tmp, int preval, int n, vector<int>& c, const vector<int>& v, const vector<vector<int>>& G) {
    c[tmp] = v[tmp] + preval;
    for (auto i : G[tmp]) if (c[i] == -1) bfs(i,c[tmp],n,c,v,G);
}

int main() {
    int n,q; cin>>n>>q;
    vector<int> v(n,0),c(n,-1);
    vector<vector<int>> Graph(n);
    for (int i = 0; i < n - 1; i++) {
        int a,b; cin>>a>>b;
        a--,b--;
        Graph[a].push_back(b);
        Graph[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        int p,x; cin>>p>>x;
        p--;
        v[p]+=x;
    }
    bfs(0,0,n,c,v,Graph);
    for (int i = 0; i < n; i++) cout<<c[i]<<" ";
    cout<<"\n";
}

Measured memory_bytes: 30464
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int now = 1;
    for(int i=0; i<n; i++){
        if(a[i] == now) now++;
    }
    if(now >= 2) cout << n-now+1;
    else cout << -1;
    return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

n=int(input())
a=[int(input()) for _ in range(n)]
max_=max(a)
cnt=a.count(max_)
pos=a.index(max_)

if cnt>1:
    for i in range(n):
        print(max_)
else:
    a[pos]=0
    max2_=max(a)
    for i in range(n):
        if i==pos:
            print(max2_)
        else:
            print(max_)


Measured memory_bytes: 12628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    string ans = "Yes\n";
    for(int i = 0;i < s.size();i++){
        if(s[i] != s[s.size()-i-1])ans = "No\n";
    }
    cout << ans;
    return 0;
}


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

using namespace std;

int main()
{
	int i = 1;
	while (1) {
		int x;
		cin >> x;
		if (x == 0)
			break;
		printf("Case %d: %d\n", i++, x);		
	}
	
	return 0;
}

Measured memory_bytes: 3152
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let x: i64 = sc.read();
    let k: usize = sc.read();
    let d: usize = sc.read();

    let div = x.abs() as usize / d;
    let ans = if div >= k {
        x.abs() as usize - k * d
    } else {
        if (k - div) % 2 == 0 {
            x.abs() as usize - div * d
        } else {
            (div + 1) * d - x.abs() as usize
        }
    };
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2260
# import itertools
# import math
import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
X, K, D = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

X_abs = abs(X)

if X_abs > K * D:
    print(X_abs - (K * D))
    sys.exit()
else:
    j = X_abs // D
    i = X_abs - (j * D)
    if (K - j) % 2 == 0:
        print(i)
    else:
        print(abs(i - D))

Measured memory_bytes: 8948
def build_combinations_counter(N=10**6, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv)

def resolve():
    X, Y = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(N=10**6, p=MOD)
    total = 0
    for x in range(X+1):
        if (X-x)/2 != Y-2*x:
            continue
        y = Y-2*x
        total += counter(x+y, x)
        total %= MOD
    print(total)


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 212680
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

S = X()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9972
N = gets.to_i

a = Array.new(2){Array.new(N,0)}

a[0] = gets.split.map(&:to_i)
a[1] = gets.split.map(&:to_i)

a[0].unshift(0)
a[1].unshift(0)

sum = Array.new(2){Array.new(N+1,0)}

for i in 0..1 do
  for j in 1..N do
    sum[i][j] = sum[i][j-1] + a[i][j]
  end
end

max = 0
for j in 1..N do
  candy = sum[0][j] + (sum[1][N] - sum[1][j-1])
  max = candy if max < candy
end

puts max


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

bool check(const char c){
    return(c=='A' or c=='C' or c=='G' or c=='T');
}

int main(void){
    string S;
    cin >> S;

    size_t len{0};

    for(size_t s{0}; s<S.size(); ++s){
        for(size_t e{0}; e<S.size()-s; ++e){

            if(not check(S.at(s+e))){
                break;
            }
            size_t n = e+1;
            if(n>len){
                len = n;
            }
        }
    }

    cout << len << endl;
}


Measured memory_bytes: 3580
X, Y = map(int, input().split())
cnt = 0
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
if  (X + Y) % 3 != 0:
    print(0)
    exit()

x = (2*Y - X) // 3
y = (2*X - Y) // 3
if x < 0 or y < 0 :
  print(0)
  exit()
print(cmb(x+y, x) % (10**9 + 7))

Measured memory_bytes: 44148
#include<map>
#include<queue>
#include<string>
#include<iostream>
#include<cstdio>
using namespace std;
struct node{string ss;int step;}s;
map<string,int>m;
void bfs(void){
    s.ss="01234567";
    s.step=0;
    queue<node>q;
    while(!q.empty())q.pop();
    q.push(s);
    while(!q.empty()){
        node ne=q.front();q.pop();
        if(m[ne.ss])continue;
        m[ne.ss]=ne.step;
        int pos=ne.ss.find('0');
        node no;
        //change the position
        if(pos==0||pos==4){
            no=ne;
            char temp=no.ss[pos];
            no.ss[pos]=no.ss[pos+1];
            no.ss[pos+1]=temp;
            no.step++;
            q.push(no);
        }
        else if(pos==3||pos==7){
            no=ne;
            char temp=no.ss[pos];
            no.ss[pos]=no.ss[pos-1];
            no.ss[pos-1]=temp;
            no.step++;
            q.push(no);
        }
        else{
            no=ne;
            char temp=no.ss[pos];
            no.ss[pos]=no.ss[pos-1];
            no.ss[pos-1]=temp;
            no.step++;
            q.push(no);

            no=ne;
            temp=no.ss[pos];
            no.ss[pos]=no.ss[pos+1];
            no.ss[pos+1]=temp;
            no.step++;
            q.push(no);
        }
            no=ne;
            char temp=no.ss[pos];
            no.ss[pos]=no.ss[(pos+4)%8];
            no.ss[(pos+4)%8]=temp;
            no.step++;
            q.push(no);
    }
    m["01234567"]=0;
}
int main(void){
    bfs();
    int num,cnt=0;
    string s;
    while(cin>>num){
        char ch=num+'0';
        s+=ch;
        if(++cnt==8){
            cnt=0;
            cout<<m[s]<<endl;
            s="";
        }
    }
}

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

using namespace std;

using pii = pair<int, int>;
using pll = pair<long long, long long>;

constexpr int INF = (int)1e9+7;
constexpr long long LLINF = (long long)1e18+7;

int main()
{
    int r;
    cin >> r;
    cout.precision(20);
    cout << 2.0 * M_PI * r << endl;
}


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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    long long n, m, k; cin >> n >> m >> k;
    long long a[n+1], b[m+1], mx = 0;
    a[0] = b[0] = 0;
    for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i-1]; }
    for (int i = 1; i <= m; i++) { cin >> b[i]; b[i] += b[i-1]; }
    long long i = 0;
    for (int j = n; j >= 0; j--) 
    {
        long long x = k - a[j];
        if(x < 0) continue;
        for(; i <= m; i++)
        {
            if(b[i] > x)
            {
                i--;
                break;
            }
        }
        if(i > m) i--;
        mx = max(mx, j + i);
    }
    cout << mx << '\n';
    return 0;
}


Measured memory_bytes: 6704
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;

int main() {
  long long int a, b, x;
  long long int ans, num1, num2;
  cin >> a >> b >> x;

  num1 = b / x;

  if (a == 0) {
    ans = num1 + 1;
  } else {
    num2 = (a - 1) / x;
    ans = num1 - num2;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  
  int n,k;
  char s[11];
  
  scanf("%d\n%s\n%d\n",&n,&s,&k);
  
  char letter;
  letter=s[k-1];
    
  for(int i; i<strlen(s); i++){
    if(letter==s[i]){
     printf("%c",letter);
    }else{
     printf("*");
    }
  }
  
  return 0;
}

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

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

    vector<string> vec(10);
    int vec_i = -1;

    int h;
    int m;
    while(s != "-") {
        if (s.size() > 1) {
            vec_i++;
            vec[vec_i] = s;
            cin >> m;
            for(int i=0; i<m; ++i) {
                cin >> h;
                vec[vec_i] = vec[vec_i].substr(h, vec[vec_i].size()-h) + vec[vec_i].substr(0, h);
            }
        }
        cin >> s;
    }

    for(int i=0; i<=vec_i; ++i) {
        cout << vec[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3216
<?php
$d = trim(fgets(STDIN));
if ($d === '25') {
    echo 'Christmas';
} elseif ($d === '24') {
    echo 'Christmas Eve';
} elseif ($d === '23') {
    echo 'Christmas Eve Eve';
} elseif ($d === '22') {
    echo 'Christmas Eve Eve Eve';
}


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

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return

#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define repd(i,a,b) for (ll i = (a); i >= b; i--)
#define repdz(i,a) for (ll i = a; i >=0; i--)
#define trav(a, x) for (auto& a : x)

#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define llin(a) ll a; cin>>a;
#define llin2(a,b) ll a,b; cin >>a>>b;
#define llin3(a,b,c) ll a,b,c; cin>>a>>b>>c;
#define full(v) v.begin(),v.end()

void solve()
{
    int x,y,z;
    cin >> x >> y >> z; 
    cout << z << " " << x <<" "<< y<<endl;
}
int main()
{
    //ios_base::sync_with_stdio(false);
    //llin(t);
    //while (t--)
    //{
        solve();
    //}
}


Measured memory_bytes: 256
let cnt = ref 0

let insertion_sort (n:int) ?(gap=1) (a:int array) =
  for i=gap to n-1 do
    let v = a.(i) in
    let j = ref (i - gap) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+gap) <- a.(!j);
      j := !j - gap;
      incr cnt;
    done;
    a.(!j+gap) <- v
  done

let shell_sort (array:int array) (n: int) =
  let rec gen_gaps = function
      [] -> gen_gaps [1]
    | h::t when h > n -> t
    | h::_ as l -> gen_gaps ((float_of_int h |> ( *. ) 2.25 |> int_of_float) ::l) in
  let gaps = (if n > 701 then gen_gaps [701;301;132;57;23;10;4;1]
              else List.filter ((>=) n) [701;301;132;57;23;10;4;1])
             |> Array.of_list in
  let m = Array.length gaps in
  for i=0 to m-1 do
    insertion_sort n ~gap:gaps.(i) array;
  done;
  Printf.printf "%d\n" m;
  Array.iteri
    (fun i x -> Printf.printf (if i=m-1 then "%d\n" else "%d ") x)
    gaps;
  Printf.printf "%d\n" !cnt;
  array

let () =
  let n = read_int () in
  let rec read a = function
      i when i = n -> a
    | i -> a.(i) <- (read_int ());
      read a (i+1) in
  let a = read (Array.make n 0) 0 in
  Array.iter (Printf.printf "%d\n") (shell_sort a n)

Measured memory_bytes: 12488
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x;
	cin >> x;
	bitset<32> b(x);
	cout << b << endl;
	cout << (~b) << endl;
	cout << (b << 1) << endl;
	cout << (b >> 1) << endl;
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, r;
  cin >> n >> r;
  
  if(n>= 10)
    cout << r << "\n";
  else
    cout << r +100*(10 -n) << "\n";
  
  //cout << fixed << setprecision(10) << n << "\n";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int A,B; cin >> A >> B;
	cout << max(A-B-B,0) << endl;
}


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

int main(){
  string s;
  cin>>s;
  int ans=0;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()-1-i])ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3592
#include<stdio.h>

int n,m,ans,lake[100][100];
int x[4] = {0,1,0,-1},y[4] = {-1,0,1,0};


void func(int i,int j,int n){
	lake[i][j] = 0;
	if(n > ans)ans=n;
	
	for(int k = 0;k < 4; k++){
		if(lake[i+x[k]][j+y[k]] && i+x[k] >= 0 && j+y[k] >= 0  && j+y[k] < m){
			func(i+x[k],j+y[k],n+1);
			lake[i+x[k]][j+y[k]] = 1;
		}
	}
	lake[i][j] = 1;
}
		

int main(void){
	while(scanf("%d%d", &m, &n) && n && m){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				scanf("%d", &lake[i][j]);
			}
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(lake[i][j])func(i,j,1);
			}
		}
		
		printf("%d\n",ans);
		ans = 0;
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				lake[i][j] = 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long int
#define inv(name,Type,size) vector<Type> name(size);for(int index=0;index<n;index++) cin>>name[index];
#define F(a,n,i) for(int i=a;i<n;i++)
#define pb push_back
#define endl "\n"
#define mod 10000000007
#define modpro 99824435
using namespace std;

void solve(){
	int n;
	cin>>n;
	inv(a,ll,n);
	sort(a.rbegin(),a.rend());
	ll ans=a[0];
	queue<ll> places;
	places.push(a[1]);
	places.push(a[1]);
	F(2,n,i){
		ans+=places.front();
		places.pop();
		places.push(a[i]);
		places.push(a[i]);
	}
	cout<<ans;
}
int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  
  //int t;cin>>t;while(t--) solve(),cout<<endl;
  solve();
}



Measured memory_bytes: 6384
l,r=map(int,input().split())
L=[]
if r-l>2018:
  print(0)
else:
  ans=[]
  for i in range(0,r-l+1):
    L.append((l+i)%2019)
  for i in range(len(L)):
    for j in range(i+1,len(L)):
      ans.append((L[i]*L[j])%2019)
  print(min(ans))

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

using namespace std;

#define endl            "\n"
#define sz(x)          (int) (x.size())
#define all(v)          v.begin(), v.end()
#define isOdd(n)       (n&1)
#define pow(n, m)      (ll)powl(n, m)
#define clr(x, val)     memset(x, val, sizeof(x))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;


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

    string s; cin >> s;
    int n = s.size(), x = 0;
    for(auto &c : s){
        x += (c - '0');
        x %= 9;
    }
    cout << (!x ? "Yes" : "No");
    return 0;
}



Measured memory_bytes: 3728
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	int32_t N;
	cin >> N;

	vector<int64_t> A(N + 1), B(N);
	for (int32_t i = 0; i < N + 1; i++) {
		cin >> A[i];
	}
	for (int32_t i = 0; i < N; i++) {
		cin >> B[i];
	}

	int64_t total = 0;
	for (int32_t i = 0; i < N; i++) {
		int64_t _min = min(A[i], B[i]);
		A[i] -= _min;
		B[i] -= _min;
		total += _min;

		_min = min(A[i + 1], B[i]);
		A[i + 1] -= _min;
		B[i] -= _min;
		total += _min;
	}

	cout << total << endl;

	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
    for(int i=0;i<=n;i++) {
    	for(int j=0;j<=m;j++) {
    		int buff=Math.max(0,(m-j)*i)+Math.max(0,(n-i)*j);
    		//System.out.println(buff);
    		if(buff==k) {
    			System.out.println("Yes");
    			System.exit(0);
    		}
    	}
    }
    System.out.println("No");
  }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,mx=0,mn=LINF;
	bool ans = false;
	cin >> n;
	vl v(n);
	rep(i, n) {
		cin >> v[i];
		mx = max(mx, v[i]);
		mn = min(mn, v[i]);
	}
	if (mx == mn) {
		if (mx == 1 || mx == n - 1 || n >= mx * 2)ans = true;
	}
	else if (mx - mn == 1) {
		ll cnt = 0;
		rep(i, n) {
			if (v[i] == mn)cnt++;
		}
		ll same = n - cnt;
		ll val = mx - cnt;
		if (same >= val * 2&&val>0) {
			ans = true;
		}
	}
	cout << (ans ? "Yes" : "No");
}



Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Integer> result = new ArrayList<Integer>();
		String[] n;

		while (true) {

			String line = sc.nextLine();
			n = line.split(" ");

			if (n[0].equals("0") && n[1].equals("0")) {
				break;
			}
			int a = Integer.parseInt(n[0]);
			int b = Integer.parseInt(n[1]);
			for (int i = 0; i < a; i++) {
				for (int j = 0; j < b; j++) {
					if (i > 0 && i < a - 1 && j > 0 && j < b - 1) {
						System.out.print(".");
					} else {
						System.out.print("#");
					}
				}
				System.out.println("");
			}

			System.out.println("");

		}
	}

}



Measured memory_bytes: 33380
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>
 
using namespace std;
 
	long long dp[1<<16];
	int nr[1<<16];
	long long a[17][17];
	long long sum[1<<16];
	
	//long long pot16[16];
	
	string binarnizapis(int a){
		string s = "";
		for(int i = 0; i < 16; i++){
			if(a&(1<<i)) s+="1";
			else s+="0";
		}
		
		return s;
		
	}
	vector < int > veki;
 
int main(){
	
	for(int i = 0; i < (1<<16); i++)
		for(int j = 0; j < 16; j++)
			if(i&(1<<j)) nr[i]++;
 
	int n; cin >> n;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++){
			cin >> a[i][j];
		}
		
	for(int i = 0; i < (1<<16); i++){
		for(int j = 0; j < 16; j++){
			for(int k = 0; k < j; k++){
				if(i&(1<<j) && i&(1<<k)) sum[i] += a[j][k];
			}
		}
		dp[i] = sum[i]; // sve za jednu grupu
	}	
	
	
//	cout << "pass" << endl;
		
		
	for(int j = 1; j < (1<<n); j++){
		
		
			
	//	cout << "-----------------------------" << endl;	
			
		veki.clear();
		for(int k = 0; k < n; k++)	if((j&(1<<k)) == 0) veki.push_back(k);
		
			
		for(int k = 1; k < (1<<(n - nr[j])); k++){
			
			int c_j = j;
			int idx = 0;
				
			for(int i = 0; i < veki.size(); i++){
				
				if(k&(1<<i)) c_j +=(1<<veki[i]);					
						
			}
			
	//		cout << k << endl;
	//		cout << binarnizapis(c_j) << " " << binarnizapis(j) << " " << binarnizapis(c_j^j) << endl;
	//		cout << dp[j] + dp[c_j^j] << " " << dp[c_j] << endl;
	//		system("pause");	
			
			dp[c_j] = max(dp[c_j],dp[j] + sum[c_j^j]);
					
		}
			
	}
	
	cout << dp[(1<<n)-1];
		
		
		
			
 
//	long long sum = 0;
//	for(int i = 0; i < (1<<16); i++){
//		sum += (1<<(16-nr[i]));
//	}
//
//	pot16[1] = 16;
//	for(int i = 2; i < 16; i++){
//		pot16[i] = 16*pot16[i-1]/i;
//	}
//
//	for(int i = 16; i >= 0; i--){
//		sum += (1<<i)*pot16[16-i];
//	}
//	
//	cout << sum << endl; 
 
 
 
 
 
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int LEFT = A - B;
    if (C < LEFT) {
        cout << 0 << endl;
    } else {
        cout << C - LEFT << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int main(void)
{
	int k, s;
	scanf("%d %d", &k, &s);
	int ans = 0;
	for (int x = 0; x <= k; ++x)
	{
		for (int y = 0; y <= k; ++y)
		{
			int z = s - x - y;
			if (z <= k && 0 <= z)
			{
				++ans;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int mod(long long int a)
{
	if(a<0) a=-a;
	return a;
}
int main(void)
{
	long long int h[200000];
	long long int cost[200000];
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}

	cost[0]=0;
	cost[1]=mod(h[1]-h[0]);

	for (int i = 2; i < n; ++i)
	{
		cost[i]=min(cost[i-1]+mod(h[i]-h[i-1]),cost[i-2]+mod(h[i]-h[i-2]));
	}
	printf("%lld\n",cost[n-1]);
}

Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_167_Registration
    {
        // https://atcoder.jp/contests/abc167/tasks/abc167_a
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力 S
            string S = Console.ReadLine();
            // 文字列の入力 T
            string T = Console.ReadLine();

            S += T[T.Length - 1];

            Console.WriteLine(S == T ? "Yes" : "No");

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25684