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

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

	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h);
	set<pair<int, int>> p;
	for (int i = 0; i < h; i++) {
		a[i].resize(w);
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#')
				p.insert({ i, j });
		}
	}
	int d[][2] = { -1, 0, 1, 0, 0, -1, 0, 1 };
	int ans = 0;
	while (!p.empty()) {
		set<pair<int, int>> s;
		for (auto const& x : p) {
			for (auto const y : d) {
				int i = x.first + y[0], j = x.second + y[1];
				if (i >= 0 && i < h && j >= 0 && j < w && a[i][j] == '.')
					s.insert({ i, j});
			}
		}
		if (!s.empty()) {
			ans++;
			for (auto const& x : s)
				a[x.first][x.second] = '#';
		}
		p = move(s);
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 48128
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		long a = in.nextLong(), b = in.nextLong(), x = in.nextLong();
		
		long l = (a + x - 1) / x;
		long r = b / x;
		
		long ans = (r>=l) ? r - l + 1 : 0;
		out.println(ans);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define endl        "\n"
#define P           pair<int, int>
#define dint        long double


void solve() {
    const int N = 101;
    int n, k; cin >> n >> k;
    int a[N]; memset(a, 0, sizeof a);
    for(int i=1; i<=k; i++) {
        int d; cin >> d;
        while(d--) {
            int x; cin >> x;
            a[x]++;
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++) ans += (a[i] == 0);
    cout << ans << endl;
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve();
    }
    return 0;

}



Measured memory_bytes: 3656
#include <iostream>

int main(){
  int a, b;
  int c, d, e,f;

  std::cin >> a >> b;

  c = a + b;
  d = a - b;
  e = a * b;

  if((c>d)&&(c>e))
    f = c;
  else if((d>c)&&(d>e))
    f = d;
  else if((e>c)&&(e>d))
    f = e;

  std::cout <<  f << std::endl;

  return 0;
  

}


Measured memory_bytes: 256
def sum_of_pattern_paint_balls(sum_of_balls, paint_colors):

    paint_pattern = paint_colors
    for i in range(1, sum_of_balls):
        paint_pattern = paint_pattern * (paint_colors - 1)

    return paint_pattern


if __name__ == '__main__':
    sum_of_balls, paint_colors = map(int, input().split())
    print(sum_of_pattern_paint_balls(sum_of_balls, paint_colors))


Measured memory_bytes: 2940
function main(input) {
  let a, b;
  const k = parseInt(input[0]);
  [a, b] = input[1].trim().split(" ").map(i => parseInt(i));

  let judge=false;

  for(let i=a;i<=b;i++){
    if(i%k===0){
      judge =true;
    }
  }
  console.log((judge)?"OK":"NG");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    ll a, b, c; cin >> a >> b >> c;
    for(int i = 0; i < b; i++){
        if(a * i % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
int main(){
  int n;cin >> n;
  double ans = 0;
  for(int i=1;i<=n;i++){
    if(i&1) ans++;
  }
  cout << ans/n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

char s[5];

int main(){
	scanf("%s", s);
	sort(s, s+4);
	if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = list(map(int,input().split()))

# xor と + の結果が等しいのは, 2進表記で各桁のbitが立っている数が1つしかない場合
# しゃく取りで求められそう
ans = 0
xor = 0 # しゃくとり の本体
l,r = 0,0

while r < N:
    # 右に要素を追加できるなら
    if xor ^ A[r] == xor + A[r]:
        ans += r-l+1
        xor ^= A[r]
    # 右の要素が追加できないなら
    else:
        # 条件を満たすまで左端を更新
        while xor ^ A[r] != xor + A[r]:
            xor ^= A[l]
            l += 1
        # 条件を満たしたので, 計算
        xor ^= A[r]
        ans += r-l+1
    r += 1

print(ans)


Measured memory_bytes: 24532
#include<stdio.h>

int main()
{
	int i, success=0, n, a=0;
	scanf("%d", &n);
	while (n != 0) {
		a = n % 10;
		n /= 10;
		if (a == 7) {
			success = 1;
			break;
		}
	}
	if (success == 1)
		printf("Yes");
	else
		printf("No");
}

Measured memory_bytes: 2144
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      int k;
      cin >> k;
      a[i].push_back(k);
    }
  }
  int ans = 1 << 30;
  for (int mask = 0; mask < (1 << n); mask++) {
    int cost = 0;
    vector<int> skill(m);
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        cost += c[i];
        for (int j = 0; j < m; j++) {
          skill[j] += a[i][j];
        }
      }
    }
    bool ok = true;
    for (int j = 0; j < m; j++) ok &= x <= skill[j];
    if (ok) ans = min(ans, cost);
  }
  cout << (ans == 1 << 30 ? -1 : ans) << endl;
  return 0;
}

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

using namespace std;

const int INF=1e9+7;

int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ret=INF;
    for(int i=0;i<n;i++){
        int j=0;
        vector<int> temp,ans;
        while(j<n){
            if(a[j]<a[i]){
                if(temp.size()>=k){
                    sort(temp.begin(),temp.end());
                    for(int l=0;l<temp.size()-k+1;l++){
                        ans.push_back(temp[l]);
                    }
                }
                temp.resize(0);
                j++;
            }
            else{
                temp.push_back(a[j]);
                j++;
            }
        }
        if(temp.size()>=k){
            sort(temp.begin(),temp.end());
            for(int l=0;l<temp.size()-k+1;l++){
                ans.push_back(temp[l]);
            }
        }
        sort(ans.begin(),ans.end());
        if(ans.size()>=q){
            ret=min(ret,ans[q-1]-ans[0]);
        }
    }
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
   
        FastIO
        int n,m;
        cin>>n>>m;
        cout<< max(0,n*(n-1)/2) + max(0,m*(m-1)/2);
        return 0;
    }

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100
static const int I=(1<<21);
static const int W=0;
static const int G=1;
static const int B=2;

int n,M[MAX][MAX];

void jk(){
    int minv,i;
    int d[MAX],color[MAX];
   
    
    for(i=0;i<n;i++){
        d[i]=I;
        color[i]=W;
    }
    
    d[0]=0;
    color[0]=G;
    


    while(1){
        minv=I;
        int u=-1;
        
        for(i=0;i<n;i++){
            if(minv>d[i]&&color[i]!=B){
                u=i;
                minv=d[i];
            }
        }


        if(u==-1) break;

        color[u]=B;
        int v;
        for(v=0;v<n;v++){
            if(color[v]!=B && M[u][v]!=I){
                if(d[v]>d[u]+M[u][v]){
                    d[v]=d[u]+M[u][v];
                    color[v]=G;
                }
            }
        }
    }
    

    for(i=0;i<n;i++){
        printf("%d %d\n",i,(d[i]==I?-1:d[i]));
    }
}



int main(){
    int i,v,j;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            M[i][j]=I;
        }
    }
    



    int k,c,u;
    
    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d%d",&v,&c);
            M[u][v]=c;
        }
    }
    
    jk();
    
    return 0;
}



Measured memory_bytes: 2060
bingoMatrix=[list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))]
n=int(input())
bingo=[]
fidnbingo=False
for i in range(n):
  bingo.append(int(input()))

result=[]
for i in range(3):
    tmpList=[]
    for j in range(3):
        tmpList.append(bingoMatrix[i][j])
    result.append(tmpList)
for i in range(3):
    tmpList=[]
    for j in range(3):
        tmpList.append(bingoMatrix[j][i])
    result.append(tmpList)
tmpList=[]
for i in range(3):
    tmpList.append(bingoMatrix[i][i])
result.append(tmpList)
result.append([bingoMatrix[0][2],bingoMatrix[1][1],bingoMatrix[2][0]])
for item in result:
    counter=0
    for i in item:
        if bingo.count(i):
            counter+=1
    if counter==3:
        fidnbingo=True
        break
if fidnbingo:
  	print ("Yes")
else:
	print ("No")

Measured memory_bytes: 3064
class Dice(object):
    def __init__(self):
        self.number = [0 for _ in range(6)]
        self.before = [0 for _ in range(6)]
        self.init = [0 for _ in range(6)]

    def set_number(self, l):
        for i in range(6):
            self.number[i] = l[i]

    def roll(self, loc):
        d = {
            'N': (1, 5, 2, 3, 0, 4),
            'S': (4, 0, 2, 3, 5, 1),
            'E': (3, 1, 0, 5, 4, 2),
            'W': (2, 1, 5, 0, 4, 3)
        }
        for i in range(6):
            self.before[i] = self.number[i]

        for i, j in enumerate(d[loc]):
            self.number[i] = self.before[j]

    def roll_clockwise(self):
        for i in range(6):
            self.before[i] = self.number[i]
        self.number = [self.before[i] for i in (0, 2, 4, 1, 3, 5)]

    def set_Top_and_Front(self, top, front):
        top_index = self.number.index(top)
        if top_index == 5:
            self.roll('E')
            self.roll('E')
        elif top_index == 4:
            self.roll('S')
        elif top_index == 3:
            self.roll('E')
        elif top_index == 2:
            self.roll('W')
        elif top_index == 1:
            self.roll('N')
        front_index = self.number.index(front)
        if front_index == 1:
            pass
        elif front_index == 2:
            self.roll_clockwise()
        elif front_index == 3:
            self.roll_clockwise()
            self.roll_clockwise()
            self.roll_clockwise()
        elif front_index == 4:
            self.roll_clockwise()
            self.roll_clockwise()

    def set_Top(self, idx):
        if idx == 5:
            self.roll('E')
            self.roll('E')
        elif idx == 4:
            self.roll('S')
        elif idx == 3:
            self.roll('E')
        elif idx == 2:
            self.roll('W')
        elif idx == 1:
            self.roll('N')
        elif idx == 0:
            pass

    def check_identity(self, another_dice):
        res = False

        for i in range(6):
            self.init[i] = self.number[i]

        for i in range(6):
            self.set_Top(i)
            for j in range(4):
                if j == 0:
                    pass
                else:
                    self.roll_clockwise()
                if self.number == another_dice:
                    res = True
                    break
            if res:
                break
            for i in range(6):
                self.number[i] = self.init[i]
        return res


if __name__ == '__main__':
    n = int(input())
    l = [[int(i) for i in input().split()] for j in range(n)]
    res = False
    for i in range(len(l) - 1):
        d = Dice()
        d.set_number(l[i])
        for j in range(i + 1, len(l)):
            res = d.check_identity(l[j])
            if res:
                break
        if res:
            break
    print('No' if res else 'Yes')



Measured memory_bytes: 5648
#include <iostream>
#include<bits/stdc++.h>
#include<map>
#include<vector>

using namespace std;

int main() {
	// your code goes here
       int x,y;
       cin>>x>>y;
       int min=x*2;
       int max=x*4;
       if(y>=min && y<=max)
       {
           if(y%4==0 || y%2==0)
           {
               cout<<"Yes"<<endl;
           }
           else
           cout<<"No"<<endl;
       }
       else
       cout<<"No"<<endl;
	    
	    
	
	
}

Measured memory_bytes: 3632
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [K-Q for i in range(N)]
for i in range(Q):
    B[A[i]-1] += 1
for i in range(N):
    if B[i] > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 11792
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/19/20 20:43:13
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,m; cin>>n>>m;
  for (int i = 0; i < m; i++) {
    int a; cin>>a;
    n -= a;
  }
  cout << (n >= 0 ? n : -1) << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main()
{
	char O[51];
	char E[51];
	int i = 0;
	scanf("%s %s", O, E);

	while (1) {
		if (O[i] == '\0') break;
		printf("%c", O[i]);
		if (E[i] == '\0') break;
		printf("%c", E[i]);

		i++;
	}

	getchar();
	getchar();

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int h, n; cin >> h >> n;
  ll sum, a;
  rep(i,n) {
    cin>>a;
    sum += a;
  }
  if(h<=sum) cout << "Yes\n";
  else cout << "No\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int field[10][10] = {0};

void dfs1(int x, int y) {
  field[y][x] += 1;
  for(int dx = -1 ; dx <= 1 ; dx++) {
    int nx = x + dx;
    if(0 <= nx && nx < 10 && nx != x) field[y][nx] += 1;
  }
  for(int dy = -1 ; dy <= 1 ; dy++) {
    int ny = y + dy;
    if(0 <= ny && ny < 10 && ny != y) field[ny][x] += 1;
  }
}

void dfs2(int x, int y) {
  for(int dx = -1 ; dx <= 1 ; dx++) {
    for(int dy = -1 ; dy <= 1 ; dy++) {
      int nx = x + dx, ny = y + dy;
      if(0 <= nx && nx < 10 && 0 <= ny && ny < 10) field[ny][nx] += 1;
    }
  }
}

void dfs3(int x, int y) {
  if(y+2 < 10) field[y+2][x] += 1;
  if(y-2 >= 0) field[y-2][x] += 1;
  if(x+2 < 10) field[y][x+2] += 1;
  if(x-2 >= 0) field[y][x-2] += 1;
  for(int dx = -1 ; dx <= 1 ; dx++) {
    for(int dy = -1 ; dy <= 1 ; dy++) {
      int nx = x + dx, ny = y + dy;
      if(0 <= nx && nx < 10 && 0 <= ny && ny < 10) field[ny][nx] += 1;
    }
  }
}

int main(void) {
  int x, y, size;
  char c1, c2;
  int max=0;
  int white=0;
  while(cin >> x >> c1  >> y >> c2 >> size) {
    if(size == 1) dfs1(x, y);
    if(size == 2) dfs2(x, y);
    if(size == 3) dfs3(x, y);
  }
  /*for(int i = 0 ; i < 10 ; i++) {
    for(int j = 0 ; j < 10 ; j++) {
      cout << field[i][j] << ' ';
    }
    cout << endl;
    }*/
  for(int i = 0 ; i < 10 ; i++) {
    for(int j = 0 ; j < 10 ; j++) {
      if(field[i][j] > max) max = field[i][j];
      if(field[i][j] == 0) white++;
    }
  }
  cout << white << endl;
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }

int main()
{
	int R, G, B, N; cin >> R >> G >> B >> N;
	int ans = 0;
	rep(r, N / R+1)rep(g, N / G+1)
	{
		int rest = N - g * G - r * R;
		if (rest >= 0 && rest % B == 0)ans++;
	}
	co(ans);
;	return 0;
}


Measured memory_bytes: 256
s = input()
cnt = 0
flg = 0
i = 0
j = -1
if len(s) == 1:
	print (0)
	exit()
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int maxn=3010;
char s[maxn],t[maxn];
int dp[maxn][maxn];
int main()
{
    cin>>s+1>>t+1;
    int lens=strlen(s+1),lent=strlen(t+1);
    for(int i=lens;i>=1;--i)
        for(int j=lent;j>=1;--j)
        {
            if(s[i]==t[j])
                dp[i][j]=dp[i+1][j+1]+1;
            else
                dp[i][j]=max(dp[i+1][j],dp[i][j+1]);
        }
    int l=1,r=1;
    while(l<=lens&&r<=lent)
    {
        if(s[l]==t[r])
        {
            putchar(s[l]);
            l++,r++;
        }
        else if(dp[l][r]==dp[l+1][r])
            l++;
        else
            r++;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 35584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793)
#define mod 1000000007

llint s;

llint find(llint n) {
	llint value = s;
	llint res = 0;
	for (llint i = 0; i < n+1 ; i++) {
		res = value % 10;
		value /= 10;
	}
	return res;
}

llint func(llint i, llint sum) {
	if (i == 0)return sum*10+find(i);
	return func(i-1,0)+pow(2,i-1)*(sum*10+find(i))
		+ func(i-1,sum*10+find(i));
}

int main() {
	cin >> s;
	cout << func((int)log10(s),0);
	return 0;
}


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

int main(){
    int n, a;
    cin >> n >> a;
    if(n%500<=a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var D, G int
	fmt.Scan(&D, &G)
	p := make([]int, D)
	c := make([]int, D)
	for i := 0; i < D; i++ {
		fmt.Scan(&p[i], &c[i])
	}
	var counts []int
	for mask := 0; mask < 1<<uint(D); mask++ {
		ps := make([]bool, D)
		for i := 0; i < D; i++ {
			ps[i] = 1<<uint(i)&mask > 0
		}
		if total, ok := calc(ps, p, c, G); ok {
			counts = append(counts, total)
		}
	}
	sort.Ints(counts)
	fmt.Println(counts[0])
}

func calc(ps []bool, p, c []int, goal int) (int, bool) {
	problems := 0
	total := 0
	for i := 0; i < len(ps); i++ {
		if ps[i] {
			total += 100*(i+1)*p[i] + c[i]
			problems += p[i]
		}
	}
	if goal <= total {
		return problems, true
	}
	for i := len(ps) - 1; i >= 0; i-- {
		if ps[i] {
			continue
		}
		for j := 1; j < p[i]; j++ {
			total += 100 * (i + 1)
			problems++
			if goal <= total {
				return problems, true
			}
		}
	}
	return 0, false
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(true){
			int h=sc.nextInt();
			int w=sc.nextInt();
			if(h==0&&w==0){
				break;
			}
			char[][] map=new char[h][w];
			boolean[][] mapFlag=new boolean[h][w];
			for(int i=0;i<h;i++){
				map[i]=sc.next().toCharArray();
			}
			int x=0;
			int y=0;
			boolean flag=true;
			while(map[y][x]!='.'){
				if(mapFlag[y][x]){
					flag=false;
					break;
				}
				mapFlag[y][x]=true;
				if(map[y][x]=='>'){
					x++;
				}else if(map[y][x]=='v'){
					y++;
				}else if(map[y][x]=='<'){
					x--;
				}else if(map[y][x]=='^'){
					y--;
				}
			}
			if(flag){
				System.out.println(x+" "+y);
			}else{
				System.out.println("LOOP");
			}
		}
	}
}

Measured memory_bytes: 21936
#include<iostream>
#include<math.h>

using namespace std;
typedef long long ll;

char a[7][7];
char b[7][7];
int n, m, k;

void copy_matrix(){
	for(int i = 0; i<n; i++){
		for(int j= 0; j<m ;j++){
			b[i][j] = a[i][j];
		}
	}
}

void color(int i, int j){
	for(int x = 0; x<n; x++){
		if(i & (1<<x)){
			for(int y = 0; y < m; y++){
				b[x][y] = '$';
			} 
		}
	}
	for(int x = 0; x<m; x++){
		if(j & (1<<x)){
			for(int y = 0; y < n; y++){
				b[y][x] = '$';
			} 
		}
	}
}

bool check(){
	int total = 0;
	for(int i = 0; i<n;i++) {
		for(int j = 0; j<m; j++){
			if(b[i][j] == '#'){
				total++;
			}
		}
	}
	if(total == k){
		return true;
	}
	return false;
}


void solve(){
	cin >> n >> m >>k;
	for(int i = 0; i<n;i++) {
		for(int j = 0; j<m; j++){
			cin >> a[i][j];
		}
	}
	
	int total = 0;
	for(int i= 0; i<(1<<n); i++){
		for(int j = 0; j <(1<<m);j++){
			copy_matrix();
			color(i,j);
			if(check()){
				total++;
			}
		}
	}
	cout << total;
}

int main(){
	solve();
	return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
int main(){
  int n, m, l;
  int i, j, k;
  long input;
  long a[200][200];
  long b[200][200];
  long c[200][200];

  //input n, m, l
  scanf("%d %d %d", &n, &m, &l);

  //input matrixA and matrixB
  for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      scanf("%ld", &input);
      a[i][j]=input;
    }
  }
  for(j=0; j<m; j++){
    for(k=0; k<l; k++){
      scanf("%ld", &input);
      b[j][k]=input;
    }
  }

  //calcuration (matrixA * matrixB)
  for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      for(k=0; k<l; k++){
        c[i][k]+=a[i][j]*b[j][k];
      }
    }
  }

  //output matrixC
  for(i=0; i<n; i++){
    for(k=0; k<l; k++){
        if(k != l-1){
            printf("%ld ", c[i][k]);
        }else{
            printf("%ld", c[i][k]);
        }
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2164
#include<iostream>
using namespace std;
int main(){
int n,a[200],b[200],c[200],i,j,aa,bb,cc;
cin>>n;
for(i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
for(i=0;i<n;i++){
aa=a[i];bb=b[i];cc=c[i];
for(j=i+1;j<n;j++){
if(aa==a[j]){a[i]=a[j]=0;}
if(bb==b[j]){b[i]=b[j]=0;}
if(cc==c[j]){c[i]=c[j]=0;}
}
}
for(i=0;i<n;i++)cout<<a[i]+b[i]+c[i]<<endl;
return 0;
}

Measured memory_bytes: 1164
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	firstNum := n % 10
	if firstNum == 3 {
		fmt.Println("bon")
	} else if ContainsInt([]int{0, 1, 6, 8}, firstNum) {
		fmt.Println("pon")
	} else {
		fmt.Println("hon")
	}
}

func ContainsInt(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}


Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h1,m1,h2,m2;
    cin >> h1 >> m1 >> h2 >> m2;
    int k;
    cin >> k;
    int a1 = h1*60 + m1;
    int a2 = h2*60 + m2;
    int r = a2-a1;
    if(r >= k){
    	cout << r-k;
    }
    else
    	cout << 0;

    return 0;
}
 

Measured memory_bytes: 3648
def main():

    N = int(input())
    A = list(map(int, input().split()))

    for v in A:
        if v % 2 == 0 and (v %3 != 0 and v % 5 != 0):
            return "DENIED"
    return "APPROVED"

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Long N, K;
        Scanner sc = new Scanner(System.in);
        N = sc.nextLong();
        K = sc.nextLong();
        Long check = Math.min((N%K),(K-N%K));
        System.out.println(check);
    }
}


Measured memory_bytes: 35772
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,i,sum=0;
	cin >> n >> k;
	int p[n];
	for(i=0;i<n;i++)
	cin >> p[i];
	sort(p,p+n);
	for(i=0;i<k;i++)
	sum+=p[i];
	cout << sum;
	return 0;
}

Measured memory_bytes: 3624
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<usize>();
    let mut edge: Vec<usize> = Vec::new();
    for n in 0..N {
        let to = read::<usize>();
        edge.push( to );
    }
    let mut curr = 1;
    let mut reachable = false;
    let mut cnt = 0;
    for n in 0..N {
        if curr == 2 {
            reachable = true;
            cnt = n;
            break;
        } else {
            curr = edge[curr-1];
        }
    }
    if reachable {
        println!("{}", cnt);
    } else {
        println!("-1");
    }
}


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


using namespace std;
int MOD = 1e9+7;
int dp[1001][1001];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  	
  	int h,w;
  	cin>>h>>w;
  	char grid[h][w];
  	

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

  	for(int i=0; i<h; i++) {
  		for(int j=0; j<w; j++) {
  			cin>>grid[i][j];
  		}
  	}

  	for(int i=0; i<h; i++) {
  		if(grid[i][0]=='#'){
  			for(int j=i; j<h; j++) {
  				dp[j][0]=0;
  			}
  			break;
  		}
  		else{
  			dp[i][0]=1;
  		}

  	}
  	for(int i=0; i<w; i++) {
  		if(grid[0][i]=='#'){
  			for(int j=i; j<w; j++) {
  				dp[0][j]=0;
  			}
  			break;
  		}
  		else{
  			dp[0][i]=1;
  		}
  	}
  	
  	for(int i=1; i<h; i++) {
  		for(int j=1; j<w; j++) {
  			dp[i][j] = (grid[i][j]=='#')?0:(dp[i-1][j] + dp[i][j-1])%MOD;
  		}
  	}
  	

  	cout<<dp[h-1][w-1]<<'\n';



    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  map<char,int> m;
  rep(i,sz(s)){
    m[s[i]]++;
  }
  for(auto it : m){
    if(it.se !=2){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>

using namespace std;

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

    int max = 0;
    int size = 0;
    for (int i=0; i<S.size(); i++) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            size += 1;
            if (max < size) {
                max = size;
            }
        } else {
            size = 0;
        }
    }
    cout << max;

    return 0;
}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

vi m{59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6, 1};
map<ll, ll> d;
ll ans = 0;

ll dp(ll n){
    decltype(d)::iterator it = d.find(n);
    if(it != d.end()){
        return it->second;
    }
    ll ans = 1000000000000000LL;
    rep(i, SZ(m)){
        if(n - m[i] > 0){
            ans = min(ans, dp(n - m[i]));
        }else if(n == m[i]){
            d.emplace(n, 1);
            return 1;  
        }
    }
    ans++;
    d.emplace(n, ans);
    return ans;
}

int main(){
    ll N;
    cin >> N;
    d.emplace(0, 0);
    cout << dp(N) << endl;
}

Measured memory_bytes: 6528
#include<iostream>
#define nijuoku 2000000000

using namespace std;

long long int saidaikouyaku(long long int a, long long int b){
    long long int big    = max(a,b);
    long long int little = min(a,b);
    long long int midori = big % little;
    
    while(true){
        if(midori == 0)return little;
        big    = little;        
        little = midori;
        midori = big % little;
    }
    return -1;
}

long long int saisyoukoubai(long long int a, long long int b){
    
    long long int big    = max(a,b);
    long long int little = min(a,b);
    
    for(long long int i = big; i < nijuoku; i += big){
        if(i % little == 0)return i;        
    }
    return -1;
};

            
int main(){

    long long int a, b;
    
    while(cin >> a >> b){
        cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int n, r;
int a[100];
int main(){
    cin >> n;
    for(int i = 1 ; i <= n ; i++)cin >> a[i];

    for(int i = 2 ; i < n ; i++){
        if((a[i-1] < a[i] && a[i] < a[i+1])||(a[i-1] > a[i] && a[i] > a[i+1]))r++;
    }
    cout << r;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//
P f(int x){
  int a = x%10;
  int b = 0;
  while (x){
    b = x;
    x /= 10;
  }
  return P(a, b);
}
 
int main(){
  int n;
  cin >> n;
  map<P, int> mp;
  for (int i = 1; i <= n; i++){
    P p = f(i);
    mp[p]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++){
    P p = f(i);
    P q = P(p.second, p.first);
    ans += mp[q];
  }
  cout << ans << endl;
}



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

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var flag = new char[N];
            for(int i = 0; i < N; i++)
            {
                var p = cin.ReadInt;
                if (p == i + 1)
                {
                    flag[i] = '1';
                }
                else
                {
                    flag[i] = '0';
                }
            }
            var ans = 0L;
            for(int i = 0; i < N; i++)
            {
                if(flag[i] == '1')
                {
                    ans++;
                    i++;
                }
            }
            WriteLine(ans);
        }

        /*public long C(long n, long r)
        {
            if (r == 0 || r == n) return 1L;
            if (n < r) return 0L;
            long[,] Pascal = new long[n + 1, n + 1];
            Pascal[0, 0] = 1;
            for (long i = 1; i <= n; i++)
            {
                Pascal[i, 0] = 1;
                Pascal[i, i] = 1;
                for (long j = 1; j < n; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[n, r];
        }*/

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


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

namespace CSharpSample01
{
    
    class Program
    {

       
        static void Main(string[] args)
        {
            string enki = Console.ReadLine();

            if(enki == "A")
            {
                Console.WriteLine("T");
            }
            else if(enki == "T")
            {
                Console.WriteLine("A");
            }
            else if(enki == "G")
            {
                Console.WriteLine("C");
            }
            else
            {
                Console.WriteLine("G");
            }
            
        }
    }
}


Measured memory_bytes: 11092
import itertools
import collections
n = int(input())
aaa = list(map(int, input().split()))
cnt = [0] * n
cnt[0] = aaa[0]
for i in range(1, n):
    cnt[i] = cnt[i - 1] + aaa[i]
cnt = [0] + cnt
num_cnt = collections.Counter(cnt)
ans = 0
for num in num_cnt.most_common():
    if num[1] != 1:
        ans += num[1] * (num[1] - 1) // 2
print(ans)

Measured memory_bytes: 47984
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin >> N;
	int a[N];
	int sum = 0;
	for(int i=0;i<N;i++){
		cin >> a[i];
		sum = sum ^ a[i];
	}
	for(int i=0;i<N;i++){
		cout << (sum ^ a[i]);
		if(i < N-1) cout << " ";
	}
	cout << endl;
}


Measured memory_bytes: 4268
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;


int main()
{
    long long n,a,b;
    
    cin >> n >> a >> b;
    
    long long d = b-a;
    
    
    if (d%2 == 0){
        cout << d/2 << endl;
    }
    else {
        cout << min(a-1,n-b)+1+d/2 << endl;
    }
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

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

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define LINF		((ll)1 << 63 -1)
#define INF 		(1<<29)
#define MINF		-2000000007
#define MAX 		100050

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//


//
int main(){
	int N,M;cin>>N>>M;
	vector<tuple<int,int,int>> city(M);
	REP(i,M){
		cin>>get<0>(city[i])>>get<1>(city[i]);
		get<2>(city[i]) = 1;
	}

	V order(M);
	iota(ALL(order),0);
	sort(ALL(order),[&](int x,int y){
		return city[x] < city[y];
	});
	int cnt=1;
	get<2>(city[order[0]]) = cnt++;
	REPS(j,1,M){
		if(get<0>(city[order[j-1]]) != get<0>(city[order[j]]) )cnt=1;
		get<2>(city[order[j]]) = cnt++;
	}

	REP(i,M)printf("%06d%06d\n",get<0>(city[i]),get<2>(city[i]));

	return 0;
}




Measured memory_bytes: 3072
n,m=map(int,input().split())
s=set([1])
b=[1]*(n+1)
for i in range(m):
  x,y=map(int,input().split())
  b[x]-=1
  b[y]+=1
  if x in s:
    s.add(y)
    if b[x]==0:
      s.remove(x)
print(len(s))

Measured memory_bytes: 18160
#include <stdio.h>

int main () {
	long long int a, sum = 0;
	scanf ("%lld", &a);
	for (long long int i = 1; i <= a; i++) {
		if (i % 3 == 0 || i % 5 == 0) {
		} else sum += i;
	}	
	printf ("%lld", sum);
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;

    double total_rate = 0;
    for (int i = 0; i < N; i++){
        int score = i+1;
        double rate = 1;
        bool flag = true;
        while (flag){
            if (score >= K){
                break;
            }
            score = score*2;
            rate = rate/2;
        }
        total_rate += rate/N;
    }
    printf("%.10f\n",total_rate);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)1e9+7) 
#define INF ((LL)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;
	vector<vector<int>> ans(H, vector<int>(W));
	int i = 0;
	int j = 0;
	REPA(c, N+1){
		int d;
		cin >> d;
		REP(t, d){
			ans[i][j]=c;
			if(i&1){
				if(j==0)++i;
				else --j;
			}else{
				if(j==W-1)++i;
				else ++j;
			}
		}
	}
	REP(i, H){
		REP(j, W){
			if(j!=0)cout << " ";
			cout << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 384
# include <bits/stdc++.h>
# define ll long long int
# define pb push_back
# define pf push_front
# define mpi make_pair
# define pi pair<ll,ll>
# define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
# define mod 1000000007
# define endl "\n"
using namespace std;
int main()
{
  fast
  ll n;
  string s;
  cin>>n>>s;
  if(n<3200)
  {
    cout<<"red";
  }
  else
  {
    cout<<s;
  }
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp(a,b) make_pair(a,b)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int ,P> PP;
struct edge { int to; int to2; int cost; };

int dp[2][2][100005];//最後の桁がi、確定がj,今の桁がk

signed main() {
	string l; cin >> l;
	dp[0][0][0] = 1;
	rep(i, l.size()) {
		rep(k,2)rep(j, 2)dp[k][1][i + 1] += dp[j][1][i] * (k+1);
		if (l[i] == '1') {
			rep(j, 2)dp[0][1][i + 1] += dp[j][0][i];
			rep(j, 2)dp[1][0][i + 1] += dp[j][0][i] * 2;
		}
		else {
			rep(j, 2)dp[0][0][i + 1] += dp[j][0][i];
		}
		rep(j, 2)rep(k, 2)dp[j][k][i + 1] %= mod;
	}
	int ans = 0;
	rep(i, 2)rep(j, 2)ans += dp[i][j][l.size()];
	cout << ans%mod << endl;
}

Measured memory_bytes: 3584
package main

import (
	"fmt"
	"io"
	"os"
	"strconv"
)

func answer(reader io.Reader, writer io.Writer) {
	var s string
	_, _ = fmt.Fscan(reader, &s)
	var a, b int
	a,_ = strconv.Atoi(string(s[:2]))
	b,_ = strconv.Atoi(s[2:])
	var yymm, mmyy bool
	yymm = false
	mmyy = false
	//fmt.Printf("s:%s, a:%d, b:%d\n",s,a,b)
	if 0 < a && a < 13 {
		// a might be month
		mmyy = true
	}
	if 0 < b && b < 13 {
		// a might be month
		yymm = true
	}
	var r string
	r = "NA"
	if mmyy == true && yymm == true {
		r = "AMBIGUOUS"
	} else if mmyy == true && yymm == false {
		r = "MMYY"
	} else if mmyy == false && yymm == true {
		r = "YYMM"
	}
	_, _ = fmt.Fprintf(writer, "%s", r)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, l;
  cin >> n >> l;
  int ans = int(((l+l+n-1)*n)/2);
  if (l <= 0 && n+l-1 >=0) {
  } else if (l <= 0) {
    ans = ans - (n+l-1);
  } else {
  	ans = ans - l;
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<bool> t(26);
    for (int i = 0; i < s.size(); ++i) t.at(s.at(i) - 'a') = 1;
    int pos = find(t.begin(), t.end(), false) - t.begin();
    if (pos == t.size()) cout << "None" << endl;
    else cout << char('a' + pos) << endl;
    return 0;
}


Measured memory_bytes: 512