akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;


bool dfs(char *str, int strLen, char *ans, char *used, int depth=0){
    if (strLen+1 < depth) {
        ans[depth] = '\0';
        cout << ans << endl;
        return true;
    }
    for (char c = (depth < strLen ? str[depth] : 'a');
            c <= 'z';
            c++) {
        // cerr << "c:" << c << endl;
        if (!used[c-'a']) {
            used[c-'a'] = 1;
            ans[depth] = c;
            ans[depth + 1] = '\0';
            // cerr << ans << endl;
            if (strcmp(str, ans) < 0){
                cout << ans << endl;
                return true;
            }
            bool r = dfs(str,strLen,ans,used,depth+1);
            if (r) return true;
            used[c-'a'] = 0;
        }
    }
    return false;
}

int main() {
    char str[30] = {0};
    char ans[30] = {0};
    char used[30] = {0};

    cin >> str;
    // cerr << str << endl;
    if (!dfs(str, strlen(str), ans, used)) {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 10000*x+5000*y+1000*z==Y:
            answer=x,y,z
            break
    else:
        continue
    break
print(*answer)

Measured memory_bytes: 9184
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
using namespace std;




int main(){
	ll a, b, c; cin >> a >> b >> c;
	if (b / a > c) cout << c << endl;
	else cout << b / a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    int m;
    cin >> m;
    vector<string> t(m);
    rep(i, m) cin >> t[i];

    int best = 0;
    rep(i, s.size()) {
        int v = 0;
        rep(j, s.size()) if (s[j] == s[i]) v++;
        rep(j, t.size()) if (t[j] == s[i]) v--;
        best = max(best, v);
    }
    
    put(best);

    return 0;
}

Measured memory_bytes: 3560
#include<iostream>

#define MAX 500000
#define SENTINEL 2000000000

using namespace std;

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right)
{
	int n1 = mid-left;
	int n2 = right-mid;
	for(int i=0;i<n1;i++) L[i] = A[left+i];
	for(int i=0;i<n2;i++) R[i] = A[mid+i];
	L[n1] = R[n2] = SENTINEL;
	int i = 0, j = 0;
	for(int k=left;k<right;k++)
	{
		cnt++;
		if(L[i] <= R[j])
		{
			A[k] = L[i++];
		}
		else 
		{
			A[k] = R[j++];
		}
	}
}

void mergeSort(int A[], int n, int left, int right)
{
	if(left+1 < right)
	{
		int mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int main()
{
	int A[MAX], n, i;
	cnt = 0;
	
	cin >> n;
	for(i=0;i<n;i++) cin >> A[i];
	
	mergeSort(A, n, 0, n);
	
	for(i=0;i<n;i++)
	{
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 6960
a=[int(input()) for _ in range(3)]
b=int(input())
c,ans=[],0
for k in range(a[0]+1):
    for i in range(a[1]+1):
        for j in range(a[2]+1):
            c.append(500*k+100*i+50*j)
for l in range(len(c)):
    if c[l]==b:
        ans+=1
print(ans)

Measured memory_bytes: 8404
#include <stdio.h>

#define Mod 1000000007

int main()
{
	int N;
	scanf("%d", &N);
	
	int i, j, k, l;
	long long dp[101][4][4][4] = {};
	for (j = 0; j < 4; j++) {
		for (k = 0; k < 4; k++) {
			for (l = 0; l < 4; l++) dp[3][j][k][l] = 1;
		}
	}
	dp[3][0][1][2] = 0;
	dp[3][0][2][1] = 0;
	dp[3][2][0][1] = 0;
	for (i = 4; i <= N; i++) {
		for (j = 0; j < 4; j++) {
			for (k = 0; k < 4; k++) {
				for (l = 0; l < 4; l++) {
					if (j == 0 && k == 1 && l == 2) continue;
					else if (j == 0 && k == 2 && l == 1) continue;
					else if (j == 2 && k == 0 && l == 1) continue;
					
					if ((k == 2 && l == 1) || (j == 2 && l == 1)) dp[i][j][k][l] = (dp[i-1][1][j][k] + dp[i-1][2][j][k] + dp[i-1][3][j][k]) % Mod;
					else dp[i][j][k][l] = (dp[i-1][0][j][k] + dp[i-1][1][j][k] + dp[i-1][2][j][k] + dp[i-1][3][j][k]) % Mod;
				}
			}
		}
	}
	
	long long ans = 0;
	for (j = 0; j < 4; j++) {
		for (k = 0; k < 4; k++) {
			for (l = 0; l < 4; l++) ans += dp[N][j][k][l];
		}
	}
	printf("%lld\n", ans % Mod);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1756
#include<bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  map<char,ll> mp;
  rep(i,n){
    string s; cin >> s;
    if(s[0]=='M' || s[0]=='A' || s[0]=='R' || s[0]=='C' || s[0]=='H') mp[s[0]]++;
  }
  if(mp.size() < 3) cout << 0;
  else{
    ll ans = 0;
    for(auto x : mp){
      for(auto y : mp){
        for(auto z : mp){
          if(!(x.first==y.first||y.first==z.first||z.first==x.first)){
            ans += x.second*y.second*z.second;
          }
        }
      }
    }
    cout << ans/6;
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)

int main(void)
{
  int n;
  char s[5001];
  scanf("%d", &n);
  scanf("%s", s);

  int dp[5001][5001] = {0}; // dp[i][j]: i番目とj番目からの一致する最大の文字数
  int i, j;
  int ans = 0;
  rep(i, n)
  {
    if (s[i] == s[n - 1])
      dp[n - 1][i] = 1;
  }
  for (i = n - 2; i >= 0; i--)
  {
    for (j = i; j >= 0; j--)
    {
      if (s[i] == s[j])
        dp[i][j] = dp[i + 1][j + 1] + 1;
      else
        dp[i][j] = 0;
    }
  }
  for (i = 0; i < n; i++)
  {
    for (j = 0; j <= i; j++)
    {
      ans = max(min(dp[i][j], i - j), ans);
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

int main() {
    int a;
    string b;
    int c;
  
   cin >> a >> b >> c;
  
  
  if (b == "+"){
    
    cout << a + c << endl;
 
    
  }else{
    
    cout << a - c << endl;
    
  }
  
   

  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

const int MAXN = 205;

int n,ans;
int G[MAXN][MAXN];
int vis[MAXN];

char s[MAXN][MAXN];

void dfs(int u,int c)
{
	if (vis[u] && vis[u] != c)
	{
		puts("-1");
		exit(0);
	}
	if (vis[u])
		return;
	vis[u] = c;
	for (int i = 1;i <= n;i++)
		if (s[u][i] == '1')
			dfs(i,c ^ 1);
}

int main()
{
	scanf("%d",&n);
	for (int i = 1;i <= n;i++)
		for (int j = 1;j <= n;j++)
			if (i != j)
				G[i][j] = 1e9;
	for (int i = 1;i <= n;i++)
	{
		scanf("%s",s[i] + 1);
		for (int j = 1;j <= n;j++)
			if (s[i][j] == '1')
				G[i][j] = 1;
	}
	memset(vis,0,sizeof(vis));
	dfs(1,0);
	for (int k = 1;k <= n;k++)
		for (int i = 1;i <= n;i++)
			for (int j = 1;j <= n;j++)
				G[i][j] = min(G[i][j],G[i][k] + G[k][j]);
	for (int i = 1;i <= n;i++)
		for (int j = 1;j <= n;j++)
			ans = max(ans,G[i][j] + 1);
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  int a,b,c,ans=0;
  string str;
  cin>>a>>b;
  c=a;
  
  while(c<=b){
    str=to_string(c);
    if(str.substr(0,1)==str.substr(4,1)&&str.substr(1,1)==str.substr(3,1)){ans++;}
    c++;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import itertools

n, m, x = map(int, input().split())
a_list = []
for _ in range(n):
    lst = list(map(int, input().split()))
    a_list.append(lst)
# print(c_list)
# print(a_list)

money = 0
skill = [0]*n
for i in range(n):
    money += a_list[i][0]
    skill = [x+y for (x, y) in zip(skill, a_list[i][1:])]
# print(skill)
for s in skill:
    if s < x:
        print(-1)
        exit()

ans = 100100100
for i in range(1, n+1):
    comb = list(itertools.combinations(a_list, i))
    # print(i, comb)
    for c in comb:
        money = 0
        skill = [0]*n
        for a in c:
            money += a[0]
            skill = [x+y for (x, y) in zip(skill, a[1:])]

        if min(skill) >= x:
            ans = min(ans, money)
print(ans)


Measured memory_bytes: 9408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,m;
  cin>>n>>m;
  ll count;
  count+=(n*(n-1))/2;
  count+=(m*(m-1))/2;
  cout<<count;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
long long N, X;
long long F(long long x, long long y)
{
	if (y % x == 0)
		return y + y - x;
	return F(y % x, x) + (y / x * x << 1);
}
int main()
{
	scanf("%lld%lld", &N, &X);
	printf("%lld\n", N + F(X, N - X));
	return 0;
}


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

using namespace std;

int solve(int a, int b) {
  if(b > a) return solve(b, a);
  if(b == 0) return a;
  return solve(b, a%b);
}

int main() {
  int a, b; cin >> a >> b;
  cout << solve(a, b) << endl;
}



Measured memory_bytes: 3080
using System;

public class p0008
{
	p0008(){
		string str;
		int n, cnt;
		
		while((str = Console.ReadLine()) != null){
			n = int.Parse(str);
			cnt = 0;
			
			for(int i = 0; i < 10; ++i)
				for(int j = 0; j < 10; ++j)
					for(int k = 0; k < 10; ++k)
						for(int l = 0; l < 10; ++l)
							if(i+j+k+l == n) ++cnt;
			
			Console.WriteLine("{0}", cnt);
		}
	}
	
	public static int Main(string[] args){
		new p0008();
		return 0;
	}
}

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

#define ROOT3 1.73205080757



class Point {
public :
	Point(double x, double y) {
		this->x = x;
		this->y = y;
	}

	Point() {
	}

	double x;
	double y;
	void setPoint(double x, double y) {
		this->x = x;
		this->y = y;
	}
};

void kochCurve(int n, Point p1, Point p2) {

	if (n == 0) {
		//cout << p1.x << " " << p1.y << endl;
		printf("%.8lf %.8lf\n",p1.x,p1.y);
		if (p2.x == 100) {
			//cout << p2.x << " " << p2.y << endl;
			printf("%.8lf %.8lf\n", p2.x, p2.y);
		}
		return;
	}

	double lx;
	double ly;
	lx = p2.x - p1.x;
	ly = p2.y - p1.y;
	Point s(p1.x + lx / 3, p1.y + ly / 3);
	Point t(p1.x+lx/3*2,p1.y+ly/3*2);
	Point u;
	if (p1.y == p2.y) {
		u.setPoint(p1.x + lx / 2, p1.y + (lx / 6 )* ROOT3);
	}
	else if (lx*ly>0) {
		u.setPoint(p1.x, p1.y + (ly / 3) * 2);
	}
	else if (lx*ly < 0) {
		u.setPoint(p2.x,p1.y+(ly/3));
	}

	kochCurve(n - 1, p1, s);
	kochCurve(n - 1, s, u);
	kochCurve(n - 1, u, t);
	kochCurve(n - 1, t, p2);

}


int main(void)
{
	int n;

	cin >> n;

	Point p1(0,0);
	Point p2(100, 0);

	kochCurve(n,p1,p2);

	return 0;
}

Measured memory_bytes: 3192
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (inline log2-ceil))
(defun log2-ceil (x)
  "Rounds up log2(x)."
  (assert (>= x 0))
  (integer-length (- (ceiling x) 1)))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (k (read)))
    (declare (uint32 n k))
    (println (/ (loop for x from 1 to n
                      sum (expt 0.5d0
                                (if (>= x k)
                                    0
                                    (log2-ceil (/ k x))))
                      of-type double-float)
                n))))

#-swank(main)


Measured memory_bytes: 19684
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
public static void main(String[] args) throws IOException {

BufferedReader br =new BufferedReader (new InputStreamReader (System.in));

String line = br.readLine( );
String[] list = line.split(" ");
int a = Integer.parseInt(list[0]);
int b = Integer.parseInt(list[1]);
int c = Integer.parseInt(list[2]);

int x =a*100+b*10+c;

System. out. println
(x%4==0?"YES":"NO");
}}

Measured memory_bytes: 21204
//初学dp不要深究 知道这行代码作用即可
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

const int maxn = 1e5 + 5;

int h[maxn] = {0};
int dp[maxn] = {0};

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d",&h[i]);
	}
	for(int i = 1; i <= n; i++)
	{
		if(i == 1)
		{
			dp[i] = 0;
		}
		else if(i == 2)
		{
			dp[i] = abs(h[2] - h[1]);
		}
		else
		{
			dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),dp[i - 2] + abs(h[i] - h[i - 2]));
		}
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  ll n,a,b;
  cin >>n>>a>>b;
  if(n>1){
  if(a>b){
    cout <<0<<endl;
  }
  else if(a==b){
    cout <<1<<endl;
  }else if(a<b){
    cout  <<n*(b-a)+2*(a-b)+1<<endl;
  }
  }else if(a==b){
    cout <<1<<endl;
  }else{
    cout<<0<<endl;
  }
}

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

int main() {
    long long int n;
    cin>>n;
    int d=n/500;
    int s1=d*500;
    int c=n%500;
    int e=n/5;
    int s2=e*5;
    cout<<s1+s2<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <stack>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int H,W;
int c[1410][1410];

int dp[1410][1410];

void preset(){
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(c[i][j]==1) dp[i][j]=0;
            else{
                if(i>0) dp[i][j]+=dp[i-1][j];
                dp[i][j]++;
            }
        }
    }
}

int getLargestRectangle(int height){
    int res=0;
    dp[height][W]=0;
    stack<pair<int,int>> ST;

    for(int j=0;j<=W;j++){
        if(ST.empty()) ST.push(make_pair(dp[height][j],j));
        else{
            pair<int,int> tp=ST.top();
            int h=tp.first;
            if(h==dp[height][j]) continue;
            else if(h<dp[height][j]){
                ST.push(make_pair(dp[height][j],j));
            }else{
                int target=j;
                while(ST.size()&&ST.top().first>=dp[height][j]){
                    pair<int,int> tp=ST.top();
                    int h=tp.first;
                    ST.pop();
                    res=max(res,h*(j-tp.second));
                    target=tp.second;
                }
                ST.push(make_pair(dp[height][j],target));
            }
        }
    }
    return res;
}

int main(){
  cin>>H>>W;
  for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
          cin>>c[i][j];
      }
  }

  preset();

  int ans=0;
  for(int i=0;i<H;i++){
      ans=max(ans,getLargestRectangle(i));
  }
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 18572
N = int(input())
A = list(map(int,input().split()))

DP = [0,0,0]
m = N//2*2
if N%2 == 0:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[1] = max(DP[0],DP[1])

    print(DP[1])

else:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[2] += A[i+2]

        DP[1] = max(DP[0],DP[1])
        DP[2] = max(DP[1],DP[2])

    print(DP[2])


Measured memory_bytes: 31540
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

std::vector<int> map[5002];

int main(){
    int N, M;
    std::cin >> N >> M;

    REP(i, N+2){
        map[i].resize(i+3);
        std::fill(map[i].begin(), map[i].end(), 0);
    }

    REP(i, M){
        int a, b, x;
        std::cin >> a >> b >> x;
        a--; b--;

        map[a][b]         += +1;
        map[a][b+1]       += -1;
        map[a+x+1][b]     += -1;
        map[a+x+1][b+x+2] += +1;
        map[a+x+2][b+1]   += +1;
        map[a+x+2][b+x+2] += -1;
    }

    REP(i, N){
        FOR(j, 1, i+1){
            map[i][j] += map[i][j-1];
        }
    }

    // puts("-----------------------------");
    // REP(i, N){
    //     REP(j, i+1){
    //         printf("%2d, ", map[i][j]);
    //     }
    //     puts("");
    // }

    REP(i, N){
        for(int j=1;i+j<N;j++){
            map[i+j][j] += map[i+j-1][j-1];
        }
    }

    // puts("-----------------------------");
    // REP(i, N){
    //     REP(j, i+1){
    //         printf("%2d, ", map[i][j]);
    //     }
    //     puts("");
    // }

    REP(i, N){
        FOR(j, i+1, N){
            map[j][i] += map[j-1][i];
        }
    }

    // puts("-----------------------------");
    // REP(i, N){
    //     REP(j, i+1){
    //         printf("%2d, ", map[i][j]);
    //     }
    //     puts("");
    // }

    int res = 0;
    REP(i, N){
        REP(j, i+1){
            if(map[i][j] > 0){
                res++;
            }
        }
    }

    std::cout << res << std::endl;
}

Measured memory_bytes: 50296
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void printvi(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printvil(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}
void printvvi(vector<vector<int>> v){
    rep(i,0,v.size()){
        rep(j,0,v[i].size())cout<<v[i][j];
        cout<<endl;
    }
}
void printvstr(vector<string> v){
    rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

signed main (){
    int n;
    cin>>n;
    cout<<n*800-n/15*200<<endl;
    
}
/*

*/


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
public static void main(String[]args){
	Scanner scan = new Scanner(System.in);
  	int a = scan.nextInt();
  	int b = scan.nextInt();
  	int c = scan.nextInt();
  if((a+b)>=c){
  	System.out.print("Yes");
  }else{
  	System.out.print("No");
  }
}
}

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

int main(void) {
	int N;
	int L[10] = {0};
	int i;
	cin >> N;
	for(i=0;i<10;i++){
		cin >> L[i];
	}
	int max = 0;
	int all = 0;
	int num = 0;

	for(i=0;i<10;i++){
		if(max < L[i]) {
			max = L[i];
			num = i;
		}
	}
	for(i=0;i<10;i++) {
		if(num != i){
			all += L[i];
		}
	}
	if(all > max) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

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

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int l,r,vis[33333];
int main(){
	ios::sync_with_stdio(false);
	cin>>l>>r;
	if(!l)cout<<0<<endl;
	else{
		vector<int>v;
		for(int i=l;i<=r;i++){
			if(vis[i%2019])break;
			vis[i%2019]=1;
			v.pb(i%2019);
		}
		LL ans=1e16;
		sort(v.begin(),v.end());
		for(int i=0;i<v.size();i++){
			for(int j=i+1;j<v.size();j++){
				ans=min(ans,(1ll*v[i]*v[j])%2019);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        String s = scan.next();
        String t = scan.next();

        if (s.length() + 1 != t.length()) {
            System.out.println("No");
            return;
        }

        if (!s.equals(t.substring(0, s.length()))) {
            System.out.println("No");
            return;
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 35704
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;cin>>N;
    map<string,int> check;
    for(int i=0;i<N;i++){
        string s;cin>>s;
        check[s]++;
    }
    auto begin = check.begin(); auto end=check.end();
    int res=0;
    for(auto i=begin;i!=end;i++){
        res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 19228
#include<bits/stdc++.h> 
using namespace std; 
int gcdEx(int a, int b, int *x, int *y){if(!a){*x=0;*y=1;return b;} 
int x1,y1,gcd=gcdEx(b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
int modI(int b, int m)      {int x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
typedef long long           ll;
typedef pair<int, int>      pii;
typedef vector<int>         vi;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define loop(i,b,n)           for(int i=b;i<n;i++)
#define loopv(i,b,n,a)         for(int i=b;i<n;i+=a)
#define loopr(i,b,n)           for(int i=n;i>=0;i--)

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define MOD                 1000000007  
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(int)(MOD+((a%MOD)-(b%MOD))%MOD):(int)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (int)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;}
y=y>>1; x=(x*x)%MOD;} return r;}

int main()
{ 
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);
  //  start_routine();
    
   ll t,sum=0,ans=0,n;
   cin>>n;
   vector<ll> a(n,0),b(n,0),c(n-1,0);
   loop(i,0,n) 
   {  
       cin>>a[i];
       a[i]-=1; 
   } 
   loop(i,0,n) 
  { cin>>b[i];
  ans+=b[i];
  
  }
   loop(i,0,n-1) 
   cin>>c[i]; 
   loop(i,0,n-1)
   { 
       if((a[i]+1)==a[i+1])
        ans+=c[a[i]]; 
   } 
   cout<<ans<<"\n";
   
  // while(t--) {   cin>>n ;  }   
   
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
#define MOD 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define ff first
#define ss second
#define INF 1e18
typedef long long ll;
typedef long double ld;
const int MAX = 2e5 + 5;
const int MAXN = 105;

// vector<ll> primes;
// void seive() {
//     vector<int> v(MAX);
//     for (int i = 2; i * i < MAX; i++) {
//         if (v[i] == 0) {
//             for (int j = i * i; j < MAX; j += i) v[j] = 1;
//         }
//     }
//     primes.pb(2);
//     for (int i = 3; i < MAX; i += 2) if (v[i] == 0) primes.pb(i);
// }
// ll pw(ll a, ll n) {
//     ll rs = 1;
//     while (n) {
//         if (n & 1) rs = rs * a;
//         n >>= 1;
//         a = a * a;
//     }
//     return rs;
// }
// bool isPrime(ll n) {
//     for (int i = 2; i * i <= n; i++) {
//         if (n % i == 0) return false;
//     }
//     return true;
// }
vector<int> a(MAX), b(MAX);
vector<int> g[MAX];
int main() {
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for printing output from output.txt
    freopen("output1.txt", "w", stdout);
#endif
    // int t;
    // cin >> t;
    // while (t--) {
    // }
    int n, m;
    cin >> n >> m;
    double x, y;
    int an = 0;
    while (n--) {
        cin >> x >> y;
        if (sqrt(x * x + y * y) * 1.0 <= m * 1.0) an += 1;
    }
    cout << an << endl;

}



Measured memory_bytes: 9412
import math
N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N-1)]
for k in range(N):
  t = 0
  for i in range(N-1-k):
    j = k + i
    if t <= CSF[j][1]:
      t = CSF[j][1] + CSF[j][0]
    else:
      t = math.ceil((t-CSF[j][1])/CSF[j][2])*CSF[j][2]+CSF[j][1]+CSF[j][0]
  print(t)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll d, c[33], s[444][33], i, j;
    cin >> d;
    for (i = 0; i < 26;i++)
        cin >> c[i];
    for (i = 0; i < d;i++)
        for (j = 0; j < 26;j++)
            cin >> s[i][j];
    for (i = 0; i < d;i++)
        cout << i % 26 + 1 << endl;
}

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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    ll inc = 0;
    for (ll j = n - 1; j >= 0; --j) {
        a[j] += inc;
        ll cnt = 0;
        if (a[j] % b[j] != 0) {
            cnt = (a[j] / b[j] + 1) * b[j] - a[j];
        }
        inc += cnt;
    }
    cout << inc << endl;
}


Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

const int N = 105;
const double eps = 1e-8;

struct point {
    int x;
    int y;
} p[N], stack[N];

bool isZero(double x) {
    return (x > 0 ? x : -x) < eps;
}

double dis(point A, point B) {
    return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}

double crossProd(point A, point B, point C) {
    return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

int cmp(const void *a, const void *b) {
    auto *c = (point *) a;
    auto *d = (point *) b;
    double k = crossProd(p[0], *c, *d);
    if (k < eps || (isZero(k) && dis(p[0], *c) > dis(p[0], *d))) return 1;
    return -1;
}

int Graham(int n) {
    int x = p[0].x;
    int y = p[0].y;
    int mi = 0;
    for (int i = 1; i < n; ++i) {
        if (p[i].x < x || (p[i].x == x && p[i].y < y)) {
            x = p[i].x;
            y = p[i].y;
            mi = i;
        }
    }
    point tmp = p[mi];
    p[mi] = p[0];
    p[0] = tmp;
    qsort(p + 1, n - 1, sizeof(point), cmp);
    p[n] = p[0];
    for (int i = 0; i < 3; ++i) stack[i] = p[i];
    int top = 2;
    for (int i = 3; i < n; ++i) {
        if (crossProd(stack[top - 1], stack[top], p[i]) < 0 && top >= 2) --top;
        stack[++top] = p[i];
    }
    return top;
}

double max(double a, double b) {
    return a > b ? a : b;
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d%d", &p[i].x, &p[i].y);
    if (n == 2) printf("%.12lf\n", dis(p[0], p[1]) / 2.0);
    else {
        int top = Graham(n);
        double maxr = -1;
        double a, b, c, r, s;
        for (int i = 0; i < top; ++i) {
            for (int j = i + 1; j < top; ++j) {
                for (int k = j + 1; k <= top; ++k) {
                    a = dis(stack[i], stack[j]);
                    b = dis(stack[i], stack[k]);
                    c = dis(stack[j], stack[k]);
                    if (a * a + b * b < c * c || a * a + c * c < b * b || b * b + c * c < a * a)
                        r = max(max(a, b), c) / 2.0;
                    else {
                        s = fabs(crossProd(stack[i], stack[j], stack[k])) / 2.0;
                        r = a * b * c / (s * 4.0);
                    }
                    if (maxr < r) maxr = r;
                }
            }
        }
        printf("%.12lf\n", maxr);
    }

    return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var A int64
	scanner.Scan()
	A, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	var B int64
	scanner.Scan()
	B, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	var N int64
	scanner.Scan()
	N, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	fmt.Println(solve(A, B, N))
}
func solve(A int64, B int64, N int64) int64 {
	if N < (B - 1) {
		return (A*N)/B - A*(N/B)
	}
	return (A*(B-1))/B - A*((B-1)/B)
}


Measured memory_bytes: 1756
# AGC014A - Cookie Exchanges
def main():
    A, B, C = tuple(map(int, input().split()))
    if A == B == C:  # corner case
        flg = A % 2 == 1
        print(0 if flg else -1)
        return
    ans = 0
    while 1 not in (A % 2, B % 2, C % 2):
        A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int a,b; cin>>a>>b;
    cout<<(b-1+a-2)/(a-1)<<endl;
}

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

using namespace std;

void solve(long N, long M) {
  long K = N / 2;
  rep(i, M)
    if (i % 2 == 0)
      cout << (i / 2) + 1 << " " << N - (i / 2) << endl;
    else
      cout << K - (i / 2) << " " << K + (i / 2) + 2 << endl;
}

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

  long N, M;
  cin >> N >> M;

  solve(N, M);

  return 0;
}


Measured memory_bytes: 3656
#include"bits/stdc++.h"
using namespace std;

int main(){
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N);
	vector<int> y(M);
	for (int i = 0;i < N;++i) {
		cin >> x[i];
	}
	for (int i = 0;i < M;++i) {
		cin >> y[i];
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	cout << (max(x[x.size() - 1], X) < min(y[0], Y) ? "No War" : "War") << endl;
	return 0;
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  string s, t;  cin >> s >> t;
  int ans = 0;
  for (int i = 0; s[i]; ++i){
    if(s[i]!=t[i])  ans++;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3772
#define _CRT_SECURE_NO_WARNINGS
    #include<bits/stdc++.h>
    #define fi first
    #define se second
    #define pb push_back
    #define E "\n"
     
    using namespace std;
    const long long MOD = (long long)1e9 + 7;
     
    int n, u, v;
    long long ans;
     
    int main()
    {
    	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    	cin >> n;
    	for (int i = 1; i <= n; i++) {
    		ans += i * 1LL * (n - i + 1);
    	}
    	for (int i = 0; i < n - 1; i++) {
    		cin >> u >> v;
    		if (u > v) swap(u, v);
    		ans -= u * 1LL * (n - v + 1);
    	}
    	cout << ans << E;
    	//system("pause");
    	return 0;
    }

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

int main() {
  int h, w;
  string s[55];
  const int dx[] = {0, 1, -1, 0};
  const int dy[] = {1, 0, 0, -1};

  cin >> h >> w;
  rep(i, h) cin >> s[i];

  int cnt = 0;
  rep(i, h)rep(j, w) {
    if (s[i][j] == '#') {
      bool sharp = false;
      for (int d = 0; d < 4; d++) {
        int x = i + dx[d];
        int y = j + dy[d];

        if (x < 0 || h <= x) continue;
        if (y < 0 || w <= y) continue;
        if (s[x][y] == '#') sharp = true;
      }
      if (!sharp) cnt++;
    }
  }

  if (cnt == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans = N;
    int keta = 1;
    while(N/10>0){
        N = N/10;
        keta++;
    }
    if(keta==6) cout << 90909 << endl;
    else if(keta==4) cout << 909 << endl;
    else if(keta==2) cout << 9 << endl;
    else if(keta==1) cout << ans << endl;
    else if(keta==3) cout << ans-90 << endl;
    else if(keta==5) cout << ans-9090 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



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

        ll cnt = 0;
        while (A >= B) {
                B *= 2;
                ++cnt;
        }
        while (B >= C) {
                C *= 2;
                ++cnt;
        }

        if (cnt <= K) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    string str;
    cin>>str;
    map<string,ll> m1;
    m1["SAT"] =1;
    m1["SUN"] =2;
    m1["MON"] =3;
    m1["TUE"] =4;
    m1["WED"] =5;
    m1["THU"] =6;
    m1["FRI"] =7;
    ll ans= m1[str];
    ans = (7-ans)+2;
    ans %= 7;
    if(ans==0)
        cout<<7<<endl;
    else
        cout<<ans<<endl;
    return 0;
}


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

int winner(int n,int p);

int main(){
    int n,p;
    while(1){
        cin>>n>>p;
        if(n==0 && p==0)break;

        int ans=winner(n,p);

        cout<<ans<<endl;
    }

    return 0;
}


int winner(int n,int p){

    int cand[n];    for(int i=0;i<n;i++)cand[i]=0;
    int stoneSum=p;

    int step=0;
    int winnerNum=-1;
    while(winnerNum<0){
        for(int i=0;i<n;i++){
            if(cand[i]==stoneSum){
                winnerNum=i;
                break;
            }

            if(p>0){
                cand[i]++;
                p--;
                continue;
            }else{
                p+=cand[i];
                cand[i]=0;
                continue;
            }
        }

    }
    return winnerNum;

}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define sz(x) ((int)x.size())

vector<int> h(100005), dp(100005);
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    dp[1] = 0;
    dp[2] = llabs(h[2]-h[1]);
    for(int i = 3; i <= n; i++)
        dp[i] = min(llabs(h[i]-h[i-1]) + dp[i-1], llabs(h[i]-h[i-2]) + dp[i-2]);
    cout << dp[n] << endl;
}

Measured memory_bytes: 4656
a=int(input())
count1=0
count2=0
count3=0
count4=0
for i in range(a):
    b=str(input())
    count=0
    if b=='AC':
        count1+=1 
       
    if b=='RE':
        count2+=1 
       
    if b=='TLE':
        count3+=1 
       
    if b=='WA':
        count4+=1 
print('AC x ',end='')
print(count1)
print('WA x ',end='')
print(count4)
print('TLE x ',end='')
print(count3)
print('RE x ',end='')
print(count2)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
 
int64_t lucasSum(int lucas) {
  if(lucas == 0) {
     return 2;
  }
  
  if(lucas == 1) {
    return 1;
  }
  
  // L0,L1を初期値として設定しておく
  int64_t left_side = 2;
  int64_t right_side = 1;
  int64_t sum = 0;
  
  for(int i = 1; i < lucas; i++) {
    	sum = left_side + right_side;
    	left_side = right_side;
        right_side = sum;
  }
  
  return sum;
}
int main() {
  int N;
  cin >> N;
  
  cout << lucasSum(N) << endl;
}



Measured memory_bytes: 3608
#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<n;i++)
#define MOD 1000000007

int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    printf("%lld\n", B-A+1-B/C+(A-1)/C-B/D+(A-1)/D+B/(C*D/__gcd(C,D)) - (A-1)/(C*D/__gcd(C,D)));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
scanf("%d\n%d",&a,&b);
for(int i=1;i<4;i++){
	 if(a!=i and b!=i){
	 	 printf("%d",i);
	 }
}
return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const maxBuf = 300100

var buf []byte = make([]byte, maxBuf)
var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Buffer(buf, maxBuf)
	sc.Split(bufio.ScanWords)

	var h, w int
	sc.Scan()
	h, _ = strconv.Atoi(sc.Text())
	sc.Scan()
	w, _ = strconv.Atoi(sc.Text())

	s := make([]string, h)
	for i := 0; i < h; i++ {
		sc.Scan()
		s[i] = sc.Text()
	}

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

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if s[i][j] == '.' {
				continue
			}
			flag := false
			for k := 0; k < 4; k++ {
				ni := i + dy[k]
				nj := j + dx[k]
				if !in(ni, 0, h) || !in(nj, 0, w) {
					continue
				}
				if s[ni][nj] == '#' {
					flag = true
				}
			}
			if !flag {
				fmt.Println("No")
				return
			}
		}
	}
	fmt.Println("Yes")
	return
}

func in(x, a, b int) bool {
	return a <= x && x < b
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n, x, y;
unordered_map<int, int>v;	

int main(){
	IOS
	cin >> n >> x >> y;
	
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			int ans=min(abs(i-j), abs(i-x)+abs(j-y)+1);
			v[ans]++;
		}
	}
	for(int i=1;i<n;i++) cout << v[i] << '\n';
}


Measured memory_bytes: 3736
#include <iostream>
#include <sstream>
#include <float.h>
using namespace std;

#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>



const int mod = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> ii;

// Custom comparator

struct cmp {
    bool operator()(int a, int b) {
        return b < a;
    }
};


// Solution class
class Solution {
public:
    char sol(char c) {
        return c >= 'a' && c <= 'z' ? 'a' : 'A';
    }
};



// Run code
int main(int argc, char const *argv[])
{
    char c;
    cin>>c;

    Solution* sol = new Solution();
    cout<<sol->sol(c);


    return 0;
}


Measured memory_bytes: 3036
class MyClass():
    maxNumber = 0

    def roop(self, baseList, opeCount):
        listCount = len(baseList)
        roopMax = listCount if listCount < opeCount else opeCount
        for leftCount in range(0, roopMax):
            self.getMax(baseList[0: leftCount + 1], opeCount - leftCount - 1)

            for rightCount in range(1, roopMax - leftCount + 1):
                leftList = baseList[0: leftCount]
                rightList = baseList[listCount - rightCount : listCount]
                handList = leftList + rightList

                self.getMax(handList, opeCount - leftCount - rightCount)

                

    def getMax(self, handList, remainOpeCount):
        if len(handList) < 1:
            return

        maxVal = 0
        removeCount = 0

        if remainOpeCount > 0:
            handList.sort()
            for each in handList:
                if each < 0:
                    removeCount += 1
                    remainOpeCount -= 1
                    if remainOpeCount < 1:
                        break
        
        maxVal = sum(handList[removeCount:])
        self.maxNumber = max([maxVal, self.maxNumber])


count, opeCount = map(int, input().split())
baseList = list(map(int, input().split()))

my = MyClass()
my.roop(baseList, opeCount)
print(my.maxNumber)







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

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

    if (N % findSumOfDigits(N) == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/* Volume5-0543 Receipt */

#include <stdio.h>

#define REP(i, n) for(i = 0; i < n; i++)
#define in(x) scanf("%d", &x)

int main(void)
{
	int total, price, i;
	
	while (in(total) != EOF && total != 0){
		REP(i, 9){
			in(price);
			total -= price;
		}
		printf("%d\n", total);
	}
	
	return (0);
}

Measured memory_bytes: 596
/**
 *	@file: B.cpp
 *	@author: Huy Le
 *	@created: 08-17-2020 10:29:18
**/


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define sz(x) (int)(x).size()
const char newl = '\n';

int ts;
ll x,k,d;

void solve() {
	cin >> x >> k >> d;
	x=abs(x);
	ll fi=x/d, ans=0;
	if(fi>=k) {
		cout << (x-k*d) << newl;
		return;
	}	
	k-=fi;
	if(k%2)
		ans=d-x%d;
	else
		ans=x%d;
	cout << ans << newl;
}

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

	//cin >> ts;
	//while(ts--)
		solve();
}


Measured memory_bytes: 3648