akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    int n;
    cin >> n;
    int b[n - 1];
    rep(i, n - 1) { cin >> b[i]; }

    int a[n];
    a[0] = b[0];
    a[n - 1] = b[n - 2];
    for(int i = 1; i < n - 1; ++i) {
        a[i] = min(b[i - 1], b[i]);
    }
    /*
    rep(i, n) { cout << a[i] << ","; }
    cout << endl;
    */

    int total = 0;
    rep(i, n) { total += a[i]; }

    cout << total << endl;
}

Measured memory_bytes: 256
answer = 0
S = input()
L = len(S)
for bit in range(2**(L-1)):
    string = ""
    for m in range(L-1):
        if bit & 2**m:
            string += S[m]
            answer += int(string)
            string = ""
        else:
            string += S[m]
    string += S[L-1]
    answer += int(string)
print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * b << ' ' << 2 * (a + b) << endl;
}


Measured memory_bytes: 3092
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define mod 1000000007
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	int n,m;
	scanf("%d%d",&n,&m);
	int a[m];
	int c=0;
	ll dp[100010]={1,1};
	for(int i=0;i<m;i++){
		scanf("%d",&a[i]);
		if(a[i]==1){dp[1]=0;c++;}
	}
	for(int i=2;i<=n;i++){
		if(i==a[c]){
			c++;
			dp[i]=0;
		}else{
			dp[i]=dp[i-1]+dp[i-2];
			dp[i] %= mod;
		}
	}
	printf("%lld",dp[n]);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,m,ans=1;
    cin >> n >> m;
    vector<pair<ll,ll>> battle;
    for (ll i=0;i<m;i++){
        ll a,b;
        cin >> a >> b;
        battle.push_back(make_pair(a,b));
    }
    sort(battle.begin(),battle.end(),pairCompare);
    ll flag=battle[0].second-1;
    for (ll i=1;i<m;i++){
        if (battle[i].first>flag){
            ans++;
            flag=battle[i].second-1;
        }
        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2548
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vector<pll> &a){sort(a.begin(),a.end()) ;}
void myrev(vll &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n,k ;
	cin >> n >> k ;
	vector<pll> p(n) ;
	for(int i=0;i<n;i++) cin >> p.at(i).first >> p.at(i).second ;
	mysort(p) ;
	ll ans = -1 ;
	for(int i=0;i<n-k+1;i++){
		for(int j=i+k-1;j<n;j++){
			ll w = p.at(j).first - p.at(i).first ;
			ll cnt = 0 ;
			vll subp ;
			ll sky = max(p.at(i).second,p.at(j).second) ;
			ll grn = min(p.at(i).second,p.at(j).second) ;
			for(int l=i;l<=j;l++){
				if(grn<=p.at(l).second&&p.at(l).second<=sky) cnt++ ;
				else subp.push_back(p.at(l).second) ;
			}
			sort(subp.begin(),subp.end()) ;
			myrev(subp) ;
			ll h ;
			if(cnt>=k) h = sky-grn ;
			else{
				ll small = 30000000000 ;
				for(int l=0;l<subp.size()-(k-cnt)+1;l++){
					if(subp.at(l)<grn) small = min(small,sky-subp.at(l+(k-cnt)-1)) ;
					else if(subp.at(l+(k-cnt)-1)>sky) small = min(small,subp.at(l)-grn) ;
					else small = min(small,subp.at(l)-subp.at(l+(k-cnt)-1)) ;
				}
				h = small ;
			}
			if(ans==-1) ans = w*h ;
			else ans = min(ans,w*h) ;
//			cout << w << " " << h << endl ;
		}
	}
	cout << ans << endl ;
}


Measured memory_bytes: 256
import java.util.*

fun rec(n: Int, s: String, used: Char) {
    if (s.length == n) {
        println(s)
        return
    }

    for (i in 'a'..used) {
        rec(n, s + i, used)
    }
    if (used < 'z') {
        rec(n, s + (used + 1), used + 1)
    }
}

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    rec(n, "", 'a' - 1)
}

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

struct vec {
  double x, y;
  vec(double x, double y) : x(x), y(y) {}
  vec() : x(0), y(0) {}
  const vec operator+(const vec &v) const { return vec(x + v.x, y + v.y); }
  const vec operator-() const { return vec(-x, -y); }
  const vec operator-(const vec &v) const { return *this + (-v); }
  const vec operator*(const double d) const { return vec(x * d, y * d); }
  const vec operator/(const double d) const { return *this * (1 / d); }
  const vec unit() const { return *this / len(); };
  const double len() const { return sqrt(x * x + y * y); }
  const double dot(const vec &v) const { return x * v.x + y * v.y; }
};

typedef vec point;

point p1, p2;
vec v;

int main() {
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  v = p2 - p1;
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    point p;
    cin >> p.x >> p.y;
    vec v2 = p - p1;
    vec v3 = v.unit() * v.dot(v2) / v.len();
    point x = p1 + v3;
    printf("%.10lf %.10lf\n", x.x, x.y);
  }
}


Measured memory_bytes: 3272
s = str(input())
a = int(s[0]+s[1])
b = int(s[2]+s[3])

def month(k):
    for i in range(1,13):
        if k == i:
            return True
            break
    return False

if month(a) == True:
    if month(b) == True:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if month(b) == True:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 3060
def main():
  n = int(input())
  s = input()
  ans = s.count("R")*s.count("G")*s.count("B")
  for i in range(n-2):
    for j in range(i+1,n-1):
      k = j + j - i
      if k >= n:
        break
      elif s[i] != s[j] and s[i] != s[k] and s[k] != s[j]:
        ans -=1
  print(ans)
main()

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ull unsigned long long
#define vi vector<int>
#define vvi vector<vector<int> >
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
 #define mem(a,b) memset(a , b , sizeof a ) ; 
 int main()
 {
 	ll n;
 	cin>>n;
 	double p[n+1];
 	rep(i,1,n+1) cin>>p[i];
 	double dp1[n+1][n/2+1];
 	ll dp2[n][2];
 	/*dp1[0][1]=1;
 	dp1[0][0]=0;
 	dp2[0][1]=p[0];
 	dp2[0][0]=1-p[0];
	 */rep(i,0,n+1)
 	{
 		rep(j,0,n/2+1) dp1[i][j]=0;
	//	dp2[i][1]=p[i]*dp2[]
	 }
	dp1[1][0]=p[1];
	dp1[1][1]=1-p[1];
	
	
	
	rep(i,2,n+1)
	{
		dp1[i][0]=dp1[i-1][0]*p[i]; 	//0heads
		
		rep(j,1,n/2+1)
		{
			dp1[i][j]=dp1[i-1][j-1]*(1-p[i])+dp1[i-1][j]*p[i];
		}
	
		
	}
	
	double s=0;
	rep(i,0,n/2+1) s+=dp1[n][i];
	cout<<fixed<<setprecision(9)<<s<<endl;
	
 }

Measured memory_bytes: 35456
#include <iostream>
#include <iomanip>
using namespace std ;
int main (){

    int x ;
    double p ;
    cin >> x ;
    if(x==1)
    cout << 1;
    else if(x%2==0){
      p=(x*.5)/x ;
      cout << setprecision(9) << p ;
    }
    else if(x%2!=0){
    p=((x+1)*.5)/x;
    cout << setprecision(9) << p  ;
    }



return 0 ;
}


Measured memory_bytes: 256
local s=io.read()
local n=#s
local p=2019

local t={}
for i=1,p do
    t[i]=(i==1 and 1 or 0)
end

local combination=0
local digit=1
local smod=0
for i=n,1,-1 do
    local x=tonumber(s:sub(i,i))
    smod=(smod+x*digit)%p
    combination=combination+t[smod+1]
    t[smod+1]=t[smod+1]+1
    digit=(digit*10)%p
end
print(combination)

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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n;
int h[100010];
signed main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> h[i];
    }

    for (int i=1;i<n;i++) {
        if(h[i]>h[i-1]) h[i]--;
    }

    bool can = true;

    for (int i=0;i<n-1;i++) {
        if(h[i]>h[i+1]) can = false;
    }

    cout << (can? "Yes":"No") << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n+1), b(n);
    rep1(i, n+1) cin >> a[i];
    rep1(i, n) cin >> b[i];
    ll ans = 0, cnt = 0;
    rep1(i, n){
        ans += min(a[i], b[i]);
        b[i] -= a[i];
        if (b[i] < 0) b[i] = 0;
        ans += min(a[i+1], b[i]);
        a[i+1] -= b[i];
        if (a[i+1] < 0) a[i+1] = 0;
    }
    cout << ans << endl;
}

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

int main(){
  string S;
  cin >> S;
  
  string s1 = S.substr(0, 2), s2 = S.substr(2, 2);
  if("00" < s1 && s1 < "13" && "00" < s2 && s2 < "13"){
    cout << "AMBIGUOUS" << endl;
    return 0;
  }else if("00" < s1 && s1 < "13"){
    cout << "MMYY" << endl;
    return 0;
  }else if("00" < s2 && s2 < "13"){
    cout << "YYMM" << endl;
    return 0;
  }
  cout << "NA" << endl;
  
  return 0;
}

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

int N,K; string S;
int input()
{  
    cin>>N>>K>>S;
}

int solve()
{
    if(S[K-1]=='A') S[K-1]='a';
    else if(S[K-1]=='B') S[K-1]='b';
    else if(S[K-1]=='C') S[K-1]='c';
    cout<<S<<endl;
}

int main(){
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int64_t i=1;i<=3500;i++){
    for(int64_t j=1;j<=3500;j++){
      if(4*i*j-n*j-i*n>0&&n*i*j%(4*i*j-n*j-i*n)==0){
        cout<<i<<' '<<j<<' '<<n*i*j/(4*i*j-n*j-i*n)<<endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3672
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define vs vector<string>
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
//int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<pair<string,int>, int> &a,const pair<pair<string,int>, int> &b)
{
    if(a.ff.ff == b.ff.ff) {
        return (a.ff.ss > b.ff.ss);
    }
    return (a.ff.ff<b.ff.ff);
}
int poww(int a, int b)
{
    int res = 1;
    for(int i = 1; i<=b; ++i)
        res *= a;

    return res;
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[100001];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}

//Define mx for maximum range and MOD for large numbers
#define mx 1001
#define MOD 1000000007;
// Declare all the variables and global functions here - 
double n,t,a;
double h[mx];
int32_t main()
{
    IOS;
 //    #ifndef ONLINE_JUDGE
 //    freopen("input.txt","r",stdin);
 //    freopen("output.txt","w",stdout);
	// #endif
    /********************* From here **********************/
    cin >> n;
    cin >> t >> a;
    double ans = inf;
    double val = -1;
    rep(i, 0, n){
    	cin >> h[i];
    	if(ans > abs(t-h[i]*0.006 - a) ){
    		val = i+1;
    		ans  = abs(t-h[i]*0.006 - a);
    	}
    	//cout << abs(t-h[i]*0.006 - a) << endl;
    }

    cout << val;
}

Measured memory_bytes: 256
N,X,M=map(int,input().split())
A = [X,]
setA = {X,}
alast=X
flag=False
for i in range(min(N-1,M)):
    P=alast**2%M
    if P in setA:
        flag=True
        d = A.index(P)
        C=A[d:]
        alast=P
        break
    else:
        A.append(P)
        setA.add(P)
        alast=P
if flag:
    if alast==0:
        ans = sum(A)
    else:
        res = (N-d)%len(C)
        ans = sum(A[:d])+((N-d)//len(C))*sum(C) + sum(C[:res])
else:
    ans = sum(A) 
print(ans)

Measured memory_bytes: 13196
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>A;
    for(int i=0;i<N;i++){
        int x;
        cin>>x;
        A.push_back(x);
    }
    int dp[N+2];
    dp[1]=0;
    if(N==1){
        cout<<0<<endl;
        return 0;
    }
    dp[2]=abs(A[1]-A[0]);
        if(N==2){
    cout<<dp[2]<<endl;
    return 0;
    }
    dp[3]=min(abs(A[2]-A[0]),dp[2]+abs(A[2]-A[1]));
        if(N==3){
    cout<<dp[3]<<endl;
    return 0;
    }
    for(int i=4;i<=N;i++){
        dp[i]=min(dp[i-1]+abs(A[i-1]-A[i-2]),dp[i-2]+abs(A[i-1]-A[i-3]));
    }
    cout<<dp[N]<<endl;
    return 0;
}

Measured memory_bytes: 4064
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

struct Node {
    int key;
    Node *prev, *next;
};

// ??????????????????????????????
// *??????????????£?¨?????????¨????????????????§????????????°?????????
// ????????????????????????????????¢?????¬??????????????????????????????????????°??????????????????????????§?????????
// nil = ?§????????????°?????¢?????¬???
Node *nil;

void init() {
    nil = (Node *)malloc(sizeof(Node));
    // ?????????????????°????????????????????¢???????????????
    nil -> next = nil;
    nil -> prev = nil;
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x -> key = key;

    // ???????????´??????????´??????????
    x -> next = nil -> next;//x's next = nil's next
    nil -> next -> prev = x;//nil's next's prev = x
    nil -> next = x;//nil's next = x
    x -> prev = nil;//x's prev = nil
}

Node* listSearch(int key) {
    Node *cur = nil -> next;//??????????¬????????´????????????????

    while (cur != nil && cur -> key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if (t == nil) return;//t??????????????¨?????????????????????
    t -> prev -> next = t -> next;
    t -> next -> prev = t -> prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil -> next);
}

void deleteLast() {
    deleteNode(nil -> prev);
}

void deleteKey(int key) {
    // ????´¢????????????????????????
    deleteNode(listSearch(key));
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;

    // while(1) {
    //     if (cur == nil) break;
    //     if (isf++ > 0) printf(" ");
    //     printf("%d", cur->key);
    //     cur = cur -> next;
    // }
    // printf("\n");

    while(1) {
        if (cur == nil) break;
        if (isf++ > 0) cout << " ";
        cout << cur -> key;
        cur = cur -> next;
    }
    cout << endl;
}

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

    int n, m;
    string order;
    init();
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> order;

        if (order == "insert") {
            cin >> m;
            insert(m);
        } else if (order == "delete") {
            cin >> m;
            deleteKey(m);
        } else if (order == "deleteFirst") {
            deleteFirst();
        } else if (order == "deleteLast") {
            deleteLast();
        } else {
            cout << "error" << endl;
        }
    }

    printList();

    return 0;
}

Measured memory_bytes: 34440
n, m = map(int,input().split())

sList = []
for i in range(n):
  sList.append(tuple(map(int,input().split())))

pList = []
for i in range(m):
  pList.append(tuple(map(int,input().split())))

for i in range(n):
  for j in range(m):
      if j == 0 :
        mD = abs(sList[i][0]-pList[0][0])+abs(sList[i][1]-pList[0][1])
        minDIndex = 0
      else:
        mDT = abs(sList[i][0]-pList[j][0])+abs(sList[i][1]-pList[j][1])
        if mD > mDT:
          mD = mDT
          minDIndex = j 
  #list index と checkpoint numberの違いのため＋1
  print(minDIndex+1)



Measured memory_bytes: 3064
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        //◯△□
        //△□◯
        //
        int[] nc = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[][] d = Enumerable.Repeat(0, nc[1]).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
        int[][] c = Enumerable.Repeat(0, nc[0]).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();

        int[][] cold = Enumerable.Repeat(0, 3).Select(x => new int[nc[1]]).ToArray();
        for (int i = 0; i < nc[0]; i++)
        {
            for (int j = 0; j < nc[0]; j++)
            {
                for (int k = 0; k < nc[1]; k++)
                {
                    cold[(i + j) % 3][k] += d[c[i][j] - 1][k];
                }
            }
        }
        int min = int.MaxValue;
        for (int i = 0; i < nc[1]; i++)
        {
            for (int j = 0; j < nc[1]; j++)
            {
                if (i == j) continue;
                for (int k = 0; k < nc[1]; k++)
                {
                    if (i == k) continue;
                    if (j == k) continue;

                    min = Min(min, cold[0][i] + cold[1][j] + cold[2][k]);
                }
            }
        }
        Console.WriteLine(min);
    }
}

Measured memory_bytes: 18628
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(' ').map { it.toInt() }
    val ans = (-100 .. 100).map { y ->
        xs.map { x -> (x - y) * (x - y) }.sum()
    }.min()
    println(ans)
}

Measured memory_bytes: 38300
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<set>
using namespace std;
int main(){
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    vector<int>V(m);

    for(int i=0;i<m;i++){
        scanf("%d",&V[i]);
        V[i]=(V[i]-p+n)%n;
    }
    p=0;
    sort(V.begin(),V.end());
    int mi=min(n-V.front(),V.back());
    for(int i=0;i<V.size()-1;i++){
        mi=min(mi,min(V[i],n-V[i+1])*2+max(V[i],n-V[i+1]));
    }
    printf("%d\n",mi*100);


    return 0;
}

Measured memory_bytes: 1240
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  unordered_map<string, int>mp;
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    mp[s]++;
  }
  int mx  = 0;
  for(auto pr: mp){
    mx= max(mx, pr.second);
  }
  vector<string> ret;
  for(auto pr: mp){
    if(pr.second==mx)ret.push_back(pr.first);
  }
  sort(ret.begin(),ret.end());
  for(auto s: ret)cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 26692
//
// Created by yamunaku on 2019/12/09.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>21) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
	llong N;
	string S;

	cin >> N;
	cin >> S;

	array<vector<llong>, 10> pos;
	for (int i = 0; S[i]; ++i) {
		pos[S[i] - '0'].push_back(i);
	}

	llong ans = 0;
	for (int i = 0; i < 1000; ++i) {
		auto it = lower_bound(ALL(pos[i/100]), 0);
		if (it == pos[i/100].end()) continue;

		it = lower_bound(ALL(pos[i%100/10]), *it + 1);
		if (it == pos[i%100/10].end()) continue;

		it = lower_bound(ALL(pos[i%10]), *it + 1);
		if (it == pos[i%10].end()) continue;

		++ans;
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define nl '\n'

int isPerfectSquare(int n) {
  int root = sqrt(n);
  if (root * root == n) {
    return 1;
  } else {
    return 0;
  }
}

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

  vector<vector<int>> data(N, vector<int>(D, 0));
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> data[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int distSquared = 0;
      for (int k = 0; k < D; k++) {
        distSquared += ((data[i][k] - data[j][k]) * (data[i][k] - data[j][k]));
      }
      ans += isPerfectSquare(distSquared);
    }
  }

  cout << ans << nl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#include <numeric>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(auto itd=begin(ar); itd != end(ar); itd++) cout << "["s << itd - begin(ar) << "]:"s << *itd << endl
#define DUMPL(ar) for(auto itd=begin(ar); itd != end(ar); itd++) { cout << *itd; if(end(ar)-itd > 1) cout << ' '; } cout << endl
#define COUT(x) cout << (x) << endl
#define VCIN(ar) for(auto &vcin: (ar)) cin >> vcin
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ["s << i << "]回目---------------"s << endl
using namespace std;
// lint:64ビット 10^19
vector<int> a;
vector<int> stones(100001, -1); // 0=負け 1=勝ち
int mmin, mmax;

bool rec(int now_stone){ // false=first, 先手が勝つかどうかを返す
    if(now_stone < mmin){
        return false;
    }

    if(stones[now_stone] != -1) return stones[now_stone];
    // COUT(now_stone);
    bool win = false;
    for(int i=0; i<(int)a.size(); i++){
        if(a[i] > now_stone) break;
        bool winner = rec(now_stone - a[i]);
        if(winner == false){
            win = true;
            break;
        }
    }
    stones[now_stone] = win;

    return win;
}

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

    int n, k;
    cin >> n >> k;
    a.resize(n);
    VCIN(a);
    sort(ALL(a));
    mmin = a.front();
    mmax = a.back();

    bool ans = rec(k);
    if(ans == true){
        COUT("First");
    }else{
        COUT("Second");
    }

    // for(int i=0; i<k+1; i++){
    //     cout << stones[i] << ' ';
    // }
    // cout << endl;

    return 0;
}

Measured memory_bytes: 5376
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    const MOD: i64 = 1000000007;
    const Z: usize = 0;
    const A: usize = 1;
    const AB: usize = 2;
    const ABC: usize = 3;

    let mut dp = vec![vec![0; 4]; s.len() + 1];
    dp[0][0] = 1;
    for i in 0..s.len() {
        if s[i] == 'A' {
            dp[i + 1][Z] = dp[i][Z];
            dp[i + 1][A] = (dp[i][A] + dp[i][Z]) % MOD;
            dp[i + 1][AB] = dp[i][AB];
            dp[i + 1][ABC] = dp[i][ABC];
        } else if s[i] == 'B' {
            dp[i + 1][Z] = dp[i][Z];
            dp[i + 1][A] = dp[i][A];
            dp[i + 1][AB] = (dp[i][AB] + dp[i][A]) % MOD;
            dp[i + 1][ABC] = dp[i][ABC];
        } else if s[i] == 'C' {
            dp[i + 1][Z] = dp[i][Z];
            dp[i + 1][A] = dp[i][A];
            dp[i + 1][AB] = dp[i][AB];
            dp[i + 1][ABC] = (dp[i][ABC] + dp[i][AB]) % MOD;
        } else {
            dp[i + 1][Z] = (3 * dp[i][Z]) % MOD;
            dp[i + 1][A] = (3 * dp[i][A] + dp[i][Z]) % MOD;
            dp[i + 1][AB] = (3 * dp[i][AB] + dp[i][A]) % MOD;
            dp[i + 1][ABC] = (3 * dp[i][ABC] + dp[i][AB]) % MOD;
        }
    }

    println!("{}", dp[s.len()][ABC]);
}


Measured memory_bytes: 10492
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <bitset>
using namespace std;
int gcd(int a, int b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}
int main() {
	int n, x;
	int a[100010];
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = abs(a[i] - x);
	}
	for (int j = 1; j < n; j++) {
		a[j] = gcd(a[j - 1], a[j]);
	}
	cout << a[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
#define mod 100003
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
#define plll pair<ll,pll>
#define piiii pair<int,piii>
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
FO
#define no {cout<<"REBEL"<<endl;return;}
#define yes {cout<<"OBEY"<<endl;return;}

void solve(){
    int n;
    cin>>n;


    ull ans=0;
    for(int i=1;i<=n;i++){
        ans+=i;
        for(int j=i+i;j<=n;j+=i) ans+=j;
    }

    cout<<ans;
    return;
}
int main(){
    IO
    //TEST
    solve();
    return(0);
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

class Dice
{
public:
	int label[6];
	void N();
	void S();
	void W();
	void E();
};

void Dice::N()
{
	int newlabel[6];
	newlabel[0] = label[1];
	newlabel[1] = label[5];
	newlabel[2] = label[2];
	newlabel[3] = label[3];
	newlabel[4] = label[0];
	newlabel[5] = label[4];
	for(int i = 0; i < 6; i++) {
		label[i] = newlabel[i];
	}
}

void Dice::S()
{
	int newlabel[6];
	newlabel[0] = label[4];
	newlabel[1] = label[0];
	newlabel[2] = label[2];
	newlabel[3] = label[3];
	newlabel[4] = label[5];
	newlabel[5] = label[1];
	for(int i = 0; i < 6; i++) {
		label[i] = newlabel[i];
	}
}

void Dice::W()
{
	int newlabel[6];
	newlabel[0] = label[2];
	newlabel[1] = label[1];
	newlabel[2] = label[5];
	newlabel[3] = label[0];
	newlabel[4] = label[4];
	newlabel[5] = label[3];
	for(int i = 0; i < 6; i++) {
		label[i] = newlabel[i];
	}
}

void Dice::E()
{
	int newlabel[6];
	newlabel[0] = label[3];
	newlabel[1] = label[1];
	newlabel[2] = label[0];
	newlabel[3] = label[5];
	newlabel[4] = label[4];
	newlabel[5] = label[2];
	for(int i = 0; i < 6; i++) {
		label[i] = newlabel[i];
	}
}

int dice1() {
	Dice d;
	scanf("%d %d %d %d %d %d", &d.label[0], &d.label[1], &d.label[2], &d.label[3], &d.label[4], &d.label[5]);
	string cmd;
	cin >> cmd;
	for(int i = 0; i < cmd.size(); i++) {
		if(cmd[i] == 'N') d.N();
		else if(cmd[i] == 'S') d.S();
		else if(cmd[i] == 'W') d.W();
		else if(cmd[i] == 'E') d.E();
	}
	printf("%d\n", d.label[0]);
	return 0;
}

int dice2() {
	Dice d;
	scanf("%d %d %d %d %d %d", &d.label[0], &d.label[1], &d.label[2], &d.label[3], &d.label[4], &d.label[5]);
	int num_q;
	scanf("%d", &num_q);
	for(int i = 0; i < num_q; i++) {
		int label0, label1;
		scanf("%d %d", &label0, &label1);

		// label1
		if(label1 == d.label[0]) {
			d.S();
		} else if(label1 == d.label[1]) {
		} else if(label1 == d.label[2]) {
			d.W();
			d.S();
		} else if(label1 == d.label[3]) {
			d.E();
			d.S();
		} else if(label1 == d.label[4]) {
			d.S();
			d.S();
		} else if(label1 == d.label[5]) {
			d.N();
		}

		// label0
		if(label0 == d.label[0]) {
		} else if(label0 == d.label[2]) {
			d.W();
		} else if(label0 == d.label[5]) {
			d.W();
			d.W();
		} else if(label0 == d.label[3]) {
			d.E();
		}
		printf("%d\n", d.label[2]);
	}
	return 0;
}

int main() {
	return dice2();
}

Measured memory_bytes: 3144
a, b = map(int, input().split())
def gcd(x, y):
  if x < y:
    tmp = y
    y = x
    x = tmp
  r = x % y
  if r==0:
    return y
  while r!=0:
    r = x % y
    x = y
    y = r
  return x

g = gcd(a, b)
i = 2
c = 0
while i **2 <= g:
  if g % i == 0:
    c += 1
    while g % i == 0:
      g //= i
  i += 1
if g != 1:
  c += 1
print(c + 1)

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;

ll f(ll a, ll x){
    if(a==-1){
        return 0;
    }
    return a/x+1;
}

int main() {
    ll a,b,x;
    cin >> a >> b >> x;
    ll fa = f(a-1,x);
    ll fb = f(b,x);
    cout << fb-fa << endl;
}


Measured memory_bytes: 384
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val (h, w) = (sc.nextInt, sc.nextInt)
  val xs = Vector.fill(h)(sc.next.toCharArray).flatten
  val idx = {
    for {
      i <- 1 to h
      j <- 1 to w
    } yield (i, j)
  } zip xs

  val mx = idx.foldLeft((Map.empty[(Int, Int), Char], Set.empty[Int], Set.empty[Int])) { (acc, next) =>
    val c = next._2
    val black = c == '#'
    val h = if (black) acc._2 + next._1._1 else acc._2
    val w = if (black) acc._3 + next._1._2 else acc._3
    (acc._1.updated(next._1, c), h, w)
  }
  for {
    i <- 1 to h if mx._2.contains(i)
  } {
    for {
      j <- 1 to w if mx._3.contains(j)
    } {
      print(mx._1((i, j)))
    }
    println()
  }
}


Measured memory_bytes: 40568
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int h,w;

    cin >> h >> w;
    
    vector<vector<int>> s(h,vector<int>(w,-2));
    int white=0;

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            char tmp;
            cin >> tmp;
            if(tmp=='.'){
                s[i][j]=-1;
                white++;
            }
        }
    }

    queue<pair<int,int>> que;
    que.push({0,0});
    s[0][0] = 0;

    vector<pair<int,int>> dir = {{1,0},{-1,0},{0,1},{0,-1}};

    while (!que.empty()){
        auto now = que.front();
        que.pop();

        for(auto i:dir){
            if(now.first+i.first < 0 || now.first+i.first > h-1 || now.second+i.second < 0 || now.second+i.second > w-1) continue;
            if(s[now.first+i.first][now.second+i.second]==-1){
                s[now.first+i.first][now.second+i.second]=s[now.first][now.second]+1;
                que.push({now.first+i.first,now.second+i.second});
            }
        }
    }

    if(s[h-1][w-1]==-1){
        cout << -1 << endl;
    }else{
        cout << white-1-s[h-1][w-1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 123456;
vector<int> e[maxn];
int cs[maxn];
void bad(){
	cout << "NO" << endl;
	exit(0);
}
vector<int> eds;
int dfs(int u, int v){
	int vis = 0, mx = 0; long long sum = 0;
	for(int to : e[u]) if(to != v) {
		int val = dfs(to, u);
		sum += val;
		mx = max(mx, val);
		vis++;
	}
	if(vis == 0){
		return cs[u];
	}
	int expec = min(2, (int)e[u].size()) * cs[u];
	if(cs[u] > sum || expec < sum || cs[u] < mx) bad();
	int up = expec - sum;
	eds.push_back(up);
	return up;
}
int main(){
	int n; cin >> n;
	for(int i = 1; i <= n; i++) cin >> cs[i];
	for(int i = 0; i < n - 1; i++){
		int x, y; cin >> x >> y;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	int ch = -1;
	for(int i = 1; i <= n; i++) if(e[i].size() != 1) ch = i;
	if(ch == -1){
		if(cs[1] != cs[2]) bad();
		else cout << "YES" << endl;
		return 0;
	}
	if(dfs(ch, 0)) bad();
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 15868
k = int(input())

l = []
for i in range(17):
    ten = 10**i
    for j in range(1,1000):
        a = ten
        b = j
        n = a*b-1
        if n == 0:
            continue
        s = sum(map(int,str(n)))
        l.append([n/s,n])
l.sort()
now = 0
count = 0
i = 0
while count < k:
    if l[i][1] > now:
        now = l[i][1]
        count += 1
        print(l[i][1])
    i += 1


Measured memory_bytes: 5868
n = int(input())

mod = 10**9 + 7

a = [0]*n
c = [0]*n
g = [0]*n
t = [0]*n

a[0] = c[0] = g[0] = t[0] = 1
a[1] = c[1] = g[1] = t[1] = 4
a[2], c[2], g[2], t[2] = 16, 14, 15, 16

for i in range(3, n):
    v = (a[i-1] + c[i-1] + g[i-1] + t[i-1]) % mod
    a[i] = v
    c[i] = (v - a[i-2] - g[i-2] - 3*a[i-3]) % mod
    g[i] = (v - a[i-2] + g[i-3]) % mod
    t[i] = v
print((a[n-1] + c[n-1] + g[n-1] + t[n-1]) % mod)

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

using namespace std;

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

#define PII pair<int, int>

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

#ifdef DBG
#define _log(item) cout << #item << " = " << item << endl
#define _loga(array, val) cout << #array << "[" << val << "] = " << array[val] << endl
#else
#define _log(item)
#define _loga(array, val)
#endif

inline int gcd(int number1, int number2)
{
    int m = number1;
    int n = number2;
    if (number2 > number1) {
        m = number2;
        n = number1;
    }
    while (m != n) {
        int temp = n;
        n = m - n;
        m = temp;
    }
    return m;
}
inline int lcm(int number1, int number2)
{
    return number1 * number2 / gcd(number1, number2);
}

//--------------------





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

    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(s == "Rainy"){
        cout << "Sunny" << endl;
    }
    else{
        cout << "Rainy" << endl;
    }

    return 0;
}


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


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();



        var s = sc.chararr;
        var b = s[0];
        if (b == 'A') wr.wri("T");
        if (b == 'T') wr.wri("A");
        if (b == 'G') wr.wri("C");
        if (b == 'C') wr.wri("G");




    }

}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => strarr.Select(char.Parse).ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
using namespace std;


int main()
{
	int A, B, C;

	cin >> A >> B >> C;

	int week = C / (A * 7 + B);

	C -= (A * 7 + B) * week;

	int day = (C / A >= 7) ? 7 : (C % A == 0) ? C / A : C / A + 1;

	cout << week * 7 + day << endl;

	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <string>
#include <stddef.h>
#include <algorithm>

class Dice {
private:
	std::vector<int> faces;

	void setFaces(int f1, int f2, int f3, int f4, int f5, int f6) {
		faces[0] = f1;
		faces[1] = f2;
		faces[2] = f3;
		faces[3] = f4;
		faces[4] = f5;
		faces[5] = f6;
	}
	void toTop(int idx) {
		switch (idx) {
		case 0:
			break;
		case 1:
			roll('N');
			break;
		case 2:
			roll('W');
			break;
		case 3:
			roll('E');
			break;
		case 4:
			roll('S');
			break;
		case 5:
			roll('N');
			roll('N');
			break;
		}
		
	}
	void rotate() {
		setFaces(faces[0], faces[3], faces[1], faces[4], faces[2], faces[5]);
	}
public:
	Dice() {}
	int getTop() {
		return faces[0];
	}
	int getFront() {
		return faces[1];
	}
	int getRight() {
		return faces[2];
	}
	void setFace(int val) {
		faces.push_back(val);
	}

	void roll(char dir) {
		switch (dir) {
		case 'N':
			setFaces(faces[1], faces[5], faces[2], faces[3], faces[0], faces[4]);
			break;
		case 'S':
			setFaces(faces[4], faces[0], faces[2], faces[3], faces[5], faces[1]);
			break;
		case 'W':
			setFaces(faces[2], faces[1], faces[5], faces[0], faces[4], faces[3]);
			break;
		case 'E':
			setFaces(faces[3], faces[1], faces[0], faces[5], faces[4], faces[2]);
			break;
		}
	}

	void findTopFront(int top, int front) {
		ptrdiff_t pos = std::find(faces.begin(), faces.end(), top) - faces.begin();
		if (faces.size() > pos) {
			toTop(pos);
		}
		while (getFront() != front) {
			rotate();
		}	
	}


};

int main()
{
	Dice dice;
	int val;
	for (int i = 0; i < 6; i++) {
		std::cin >> val;
		dice.setFace(val);
	}
	int q, top, front;
	std::cin >> q;
	for (int i = 0; i < q; i++) {
		std::cin >> top >> front;
		dice.findTopFront(top, front);
		std::cout << dice.getRight() << "\n";
	}
	return 0;
}




Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  for(ll i=1;i<=3500;i++){
    for(ll j=1;j<=3500;j++){
      if(4*i*j-n*i-n*j<=0) continue;
      if((n*i*j)%(4*i*j-n*i-n*j)==0) {
        cout << i << " " << j << " " << (n*i*j)/(4*i*j-n*i-n*j) << endl;
        return 0;
      }
    }
  }

}

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

typedef long long ll;
const int N = 5e3;
int d[N+100];

int main()
{
	int k,q;
	scanf("%d%d",&k,&q);
	for(int i=1;i<=k;i++){
		scanf("%d",d+i);
	}
	while(q--)
	{
		ll n,x,m;
		scanf("%lld%lld%lld",&n,&x,&m);
		ll e = x%m;
		ll neg = 0;
		//printf("%lld ",e);
		for(int i=1;i<=k;i++){
			ll cur = d[i]%m;
			ll div = (n-1)/k;
			if((n-1)%k>=i){
				div++;
			}
			if(cur==0){
				neg += div;
			}
			e += div*cur;
		}
		printf("%lld\n",n-1-e/m-neg);
	}
}


Measured memory_bytes: 3752
package main

import (
	"fmt"
)

func divmod(a, b int) (int, int) {return a / b, a % b}

func main() {
	var x int; fmt.Scan(&x)
	q, r := divmod(x, 100)
	ans := 0
	if r <= q * 5 {ans = 1}
	fmt.Println(ans)


}

Measured memory_bytes: 512
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
maxs = max(x)
mins = min(y)

if X < max(x) and Y >= min(y) and max(x) < min(y):
    ans = 'No War'
else:
    ans = 'War'
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int i,a[32768];
	for(i=1;i<=32768;i++){
		scanf("%d",&a[i]);
		if(a[i]==0){
			break;
		}
	}
	for(i=1;i<=32768;i++){
		if(a[i]==0){
			break;
		}
		else{
			printf("Case %d: %d\n",i,a[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 644
N = int(input())
A = list(map(int, input().split()))
M = max(A)
memo = [0]*(M+1)
i = 0
while i < N:
  a = A[i]
  memo[a] += 1
  x = a+a
  while x <= M:
    memo[x] += 2
    x += a
  i += 1
print(sum([1 if m == 1 else 0 for m in memo]))



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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

int N, Q;
string S;

ll solve(int k) {
    ll d = 0, c = 0, dc = 0;
    ll ans = 0;

    REP (i, N) {
        if (S[i] == 'D') {
            d++;
        } else if (S[i] == 'M') {
            c++;
            dc += d;
        } else if (S[i] == 'C') {
            ans += dc;
        }

        int j = i - k + 1;
        if (j < 0) continue;
        if (S[j] == 'D') {
            d--;
            dc -= c;
        } else if (S[j] == 'M') {
            c--;
        }
    }

    return ans;
}

int main() {
    cin >> N >> S >> Q;
    int k;
    REP (q, Q) {
        cin >> k;
        cout << solve(k) << "\n";
    }
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    string s;
    cin>>s;
    int n=s.length();
    int L,R; L=R=-1;
    for(ri int i=0;i<n;i++)
    {
        if(s[i]=='A') { L=i; break; }
    }
    for(ri int i=n-1;~i;i--) if(s[i]=='Z')
    {
        R=i; break;
    }
    if(L<0 || R<0) puts("0");
    else printf("%lld\n",max(R-L+1,0ll));
    return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n, l; cin >> n >> l;
	int ret = 0;
	int eat = 1000000;
	for (int i=0; i<n; i++) {
		ret += (l + i);
		if (abs(l+i) < abs(eat)) eat = l+i;
	}
	cout << ret - eat << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>

using namespace std;

#define ll long long
#define ld long double
#define v vector

#define rep(i, n)      for (int i = 0; i < (int)(n); ++i)
#define rep3(i, m, n)  for (int i = (m); i < (int)(n); ++i)
#define rrep(i, n)     for (int i = (int)(n)-1; i >= 0; --i)
#define rrep3(i, m, n) for (int i = (int)(n)-1; i >= (m); --i)
#define all(x) x.begin(), x.end()
#define rall(x) x.end(x), x.begin()

#define endl '\n'


ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll solve(ll A, ll B) {
  return A*B;
}

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

  ll A, B;
  cin >> A >> B;

  auto ans = solve(A, B);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3160