akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iomanip>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define KETA 40

using namespace std;

typedef long long  ll;
typedef pair<ll,ll> P1;
typedef pair<string,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<Pi,int> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll a[200002];
ll t[200002]={};
int main() {

	ll n;
	cin>>n;
	rep(i,n){
		cin>>a[i];
		t[i+1]=a[i];
		t[i+1]+=t[i];
	}
	sort(t,t+n+1);
	ll total=0,x=1;
	for(int i=1; i<n+1; i++){
		if(t[i]==t[i-1]){
			total+=x;
			x++;
		}else x=1;
	}
	cout<<total<<endl;
	return 0;

}


Measured memory_bytes: 3328
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

ll div(int S, vector<ll>& memo) {
    if (S < 3) {
        return 0;
    }
    if (S < 6) {
        return 1;
    }
    if (memo[S-1] != 0) {
        return memo[S-1];
    }
    ll ans = 1;
    FOR(i, 3, S-2) {
        ans += div(S-i, memo);
        ans %= MOD_BIG;
    }
    memo[S-1] = ans;
    return ans;
}

//////////////////////////////////////

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

    vector<ll> memo(S);
    
    ll ans = div(S, memo);
    cout << ans << endl;
    
    //for (auto m : memo) cerr << m << endl;
    
    return 0;
}


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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<ll> &s, ll a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {

    ll n, y;
    cin >> n >> y;

    for (ll m = 0; m <= n; m++) {
        for (ll g = 0; m + g <= n; g++) {
            ll s = n - m - g;
            if (s < 0 || s > n) continue;
            if (m * 10000 + g * 5000 + s * 1000 != y) continue;
            printf("%lld %lld %lld\n", m, g, s);
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var A [3][3]int
	var flag [3][3]int
	for i := 0; i < 3; i++ {
		fmt.Scanf("%d %d %d", &A[i][0], &A[i][1], &A[i][2])
	}

	var N int
	fmt.Scanf("%d", &N)
	b := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &b[i])
	}

	for k := 0; k < N; k++ {
		for i := 0; i < 3; i++ {
			for j := 0; j < 3; j++ {
				if A[i][j] == b[k] {
					flag[i][j] = 1
				}
			}
		}
	}

	var result int = 0
	for i := 0; i < 3; i++ {
		if flag[i][0] == 1 && flag[i][1] == 1 && flag[i][2] == 1 {
			result = 1
		}
	}

	for j := 0; j < 3; j++ {
		if flag[0][j] == 1 && flag[1][j] == 1 && flag[2][j] == 1 {
			result = 1
		}
	}
	if flag[0][0] == 1 && flag[1][1] == 1 && flag[2][2] == 1 {
		result = 1
	}
	if flag[0][2] == 1 && flag[1][1] == 1 && flag[2][0] == 1 {
		result = 1
	}

	if result == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int N, M;

string berman_ford(map<P, ll>& m) {
  vector<ll> d(N, __LONG_LONG_MAX__);

  d[0] = 0;

  rep(i, N) {
    for (auto p : m) {
      int j = p.first.first;
      int k = p.first.second;
      if (d[j] == __LONG_LONG_MAX__) continue;

      ll current = d[k];
      ll cost = d[j] + p.second;

      if (current > cost) {
        d[k] = cost;
      }
    }
  }
  ll ans = -d[N - 1];

  vector<bool> negative(N, false);
  rep(i, N + 1) {
    for (auto p : m) {
      int j = p.first.first;
      int k = p.first.second;
      if (d[j] == __LONG_LONG_MAX__) continue;

      ll current = d[k];
      ll cost = d[j] + p.second;

      if (current > cost) {
        d[k] = cost;
        negative[k] = true;
      }
      if (negative[j]) negative[k] = true;
    }
  }

  return negative[N - 1] ? "inf" : to_string(ans);
}

/**
 * ベルマンフォード法 / Berman Ford
 * SeeAlso: ダイクストラ
 * 負のコストがある場合、閉経路がある場合はこちら
 * O(NM)
 * https://qiita.com/wakimiko/items/69b86627bea0e8fe29d5
 */
int main() {

  cin >> N >> M;

  map<P, ll> m;
  rep(i, M) {
    int a, b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;

    m.emplace(make_pair(a, b), -c);
  }

  string ans = berman_ford(m);
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
//#define ivorysi
#define MAXN 20005
#define eps 1e-8
#define mo 974711
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
const int64 MOD = 998244353;
int N;
int a[55],b[55];
int s[55],cnt,ans[55];
bool vis[55];
void Init() {
    scanf("%d",&N);
    for(int i = 1 ; i <= N ; ++i) scanf("%d",&a[i]);
    for(int i = 1 ; i <= N ; ++i) scanf("%d",&b[i]);
}
bool check(int x) {
    memset(vis,0,sizeof(vis));
    vis[a[x]] = 1;
    for(int i = 1 ; i <= cnt ; ++i) {
	for(int j = s[i] ; j <= 50 ; ++j) {
	    if(vis[j]) vis[j % s[i]] = 1;
	}
    }
    if(vis[b[x]]) return true;
    return false;
}
void Solve() {
    cnt = 0;
    for(int i = 50 ; i >= 1 ; --i) s[++cnt] = i;
    for(int i = 1 ; i <= N ; ++i) {
	if(!check(i)) {puts("-1");return;}
    }
    for(int i = 50 ; i >= 1 ; --i) {
	cnt = 0;
	for(int j = 50 ; j >= i ; --j) {
	    if(ans[j]) s[++cnt] = j;
	}
	for(int j = i - 1 ; j >= 1 ; --j) s[++cnt] = j;
	for(int j = 1 ; j <= N ; ++j) {
	    if(!check(j)) {
		ans[i] = 1;
		break;
	    }
	} 
    }
    int64 res = 0;
    for(int i = 50 ; i >= 1 ; --i) {
	if(ans[i]) res |= 1LL << i;
    }
    printf("%lld\n",res);
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
    return 0;
}


Measured memory_bytes: 256
import heapq
def main():
    k,n = map(int,input().split())
    a_n = map(int,input().split())
    l_1 = []
    l_2 = []
    for a_i in a_n:
        heapq.heappush(l_1,a_i)
        heapq.heappush(l_2,a_i)
    a_1 = heapq.heappop(l_2)
    heapq.heappush(l_2,a_1 + k)
    dif_m = 0
    for _ in range(n):
        start = heapq.heappop(l_1)
        goal = heapq.heappop(l_2)
        dif = goal - start
        if dif_m < dif:
            dif_m = dif
    print(k - dif_m)
                


if __name__ == "__main__":
    main()


Measured memory_bytes: 29772
// Last Change: 06/25/2019 19:16:03.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

ll n;

char Fukugou(char c, int val) {
  // small
  if (c >= 97) {
    c -= val;
    if (c < 97) {
      c -= 6;
      if (c < 65) {
        c += 58;
      }
    }
  }
  // large
  else {
    c -= val;
    if (c < 65) {
      c += 58;
      if (c < 97) {
        c -= 6;
      }
    }
  }
  return c;
}

void Solve() {
  vector<int> k(n);
  string s;
  for (auto &&e : k) {
    cin >> e;
  }
  cin >> s;

  size_t sSize = s.size();
  string ans;
  int j = 0;
  for (size_t i = 0; i < sSize; ++i) {
    ans += Fukugou(s[i], k[j]);
    ++j;
    if (j == n) {
      j = 0;
    }
  }

  cout << ans << endl;
}

int main() {
  while (cin >> n and n > 0) {
    Solve();
  }
}



Measured memory_bytes: 3164
#include<stdio.h>
#define MOD 1000000007
long powll(long a, int x){
	if(x==0){
      return 1;
    }
	long b=powll(a,x/2);
	if(x%2==0){
		b=b*b%MOD;
	}else{
		b=b*b%MOD*a%MOD;
	}
	return b;
}
long rec(long a){
	return powll(a,MOD-2);
}
long fact(long a){
	long b=1;
	while(a>0){
		b=b*a%MOD;
		a--;
	}
	return b;
}
long fra_fac(int a,int b){
	return rec(fact(a))*rec(fact(b))%MOD*fact(a+b)%MOD;
}
int main(void){
	int r1,r2,c1,c2;
	scanf("%d %d %d %d",&r1,&c1,&r2,&c2);
	long ans=fra_fac(c2+1,r2+1)+fra_fac(c1,r1)-fra_fac(c2+1,r1)-fra_fac(c1,r2+1)+MOD*2;
    printf("%ld\n",ans%MOD);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var res = -1;
            var a = ab[0] * 125;
            var mod = a % 100;
            var tmp = ((a / 100) + 1) * 10;
            if (ab[1] * 100 + mod == a) res = (int)Math.Ceiling(a / 10.0);
            else if (tmp == ab[1] * 10) res = tmp;
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13396
/**********************************************
 *Author*        :XzzF
 *Created Time*  : 2018/4/28 20:29:57
 *Ended  Time*  : 2018/4/28 20:58:36
 *********************************************/
 
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 600;
 
int n;
char s[MaxN + 5][MaxN + 5];
 
void Init() {
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			scanf(" %c", &s[i][j]);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			s[i + n][j + n] = s[i][j];
			s[i][j + n] = s[i][j];
			s[i + n][j] = s[i][j];
		}
	}
}
 
bool is_all_same() {
	char ch = s[1][1];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			if(s[i][j] != ch)
				return false;
	return true;
}
 
bool check(int x, int y) {
	for(int i = 0; i < n; i++) 
		for(int j = 0; j <= i; j++) 
			if(s[x + i][y + j] != s[x + j][y + i])
				return false;
	return true;
}
 
bool is_good() {
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			if(check(i, j)) return true;
		}
	}
	return false;
}
 
int main()
{
	while(scanf("%d", &n) != EOF)
	{
		Init();
		int ans = 0;
		if(is_all_same()) ans = n * n;
		else {
			for(int i = 1; i <= n; i++)
				if(check(1, i)) ans += n;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int N; cin >> N;
    set<int> mochi;
    rep(i, 0, N) {
      int in; cin >> in;
      mochi.insert(in);
    }
  
    cout << mochi.size() << endl;
}


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

int main() {
  int n,m;
  cin >> n >> m;
  if (n%2==1){
    for(int i=0;i<m;i++){
      cout << i+1 << " " << n-i << endl;
    }
  }
  else {
    for(int i=0;i<m;i++){
      cout << i+1+(i>=(m+1)/2) << " " << n-i << endl;
    }
  }
}


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

int counter(int bits) {
    if (bits == 0) return 0;
    return counter(bits >> 1) + (bits & 1);
}

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<vector<int> > x(n+1, vector<int>(n+1));
    vector<vector<int> > y(n+1, vector<int>(n+1));
    for (size_t i = 1; i <= n; i++) {
        cin >> a[i];
        for (size_t j = 1; j <= a[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for (int bits = 1; bits < (1<<n); bits++) {
        bool can = true;
        for (int i = 1; i <= n; i++) {
            if (bits & 1<<(i-1)) {
                for (size_t j = 1; j <= a[i]; j++) {
                    if (((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) can = false;
                }
            }
        }
        if (can) ans = max(ans, counter(bits));
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
/* Filename: ABC043C.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main{

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

		while (input.hasNext()) {
			int N = input.nextInt();
			int[] a = new int[N];
			
			int sumA = 0;
			for(int i = 0; i < a.length; ++i){
				a[i] = input.nextInt();
				sumA += a[i];
			}
			
			int avgA = (int)Math.round(sumA / (double)N);
			int cost = 0;
			
			for(int i = 0; i < a.length; ++i){
				cost += (avgA - a[i]) * (avgA - a[i]);
			}
			
			System.out.println(cost);
		}
	}

}


Measured memory_bytes: 9428
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#define SF scanf
#define PF printf
#define MAXN 1000010
#define INF 0x3FFFFFFF
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll n,n1;
ll a[MAXN];
map<ll,ll> mp;
ll p(ll x){
	if(mp.count(x))
		return mp[x];
	if(x==1)
		return 1;
	if(x%2ll==1ll)
		mp[x]=(p(x/2ll)+p(x/2ll+1ll))%MOD;
	else
		mp[x]=p(x/2ll);
	return mp[x];
}
ll que(ll x){
	if(x==1)
		return 1;
	if(x%2ll==1ll)
		return (que(x/2ll)*3ll+p(x/2ll+1ll))%MOD;
	else
		return (que(x/2ll)*3ll-p(x/2ll)+MOD)%MOD;
}
int main(){
	SF("%lld",&n1);
	n1++;
	PF("%lld\n",que(n1));
}	

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		String S = rs();
		var ca = S.ToCharArray();
		ca[3] = '8';
		Console.WriteLine(new String(ca));
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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


int main(){
	string s;
	cin >> s;
	cout << s.substr(0,4) << " " << s.substr(4) << endl;
	return 0;
}









Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define ll long long
ll l, n, x[200005];
ll y[200005];
ll dx[200005], dxprime[200005];
ll dy[200005], dyprime[200005];
int main(){
	scanf("%lld%lld", &l, &n);
	for (int i = 0; i < n; i++){
		scanf("%lld", &x[i]);
	}
	for (int i = n - 1; i >= 0; i--){
		y[n - 1 - i] = l - x[i];
	}
	for (int i = 1; i <= n; i++){
		dx[i] = dx[i - 1] + 2*x[i - 1];
		dxprime[i] = dx[i] - x[i - 1];
	}
	for (int i = 1; i <= n; i++){
		dy[i] = dy[i - 1] + 2*y[i - 1];
		dyprime[i] = dy[i] - y[i - 1];
	}
	ll answer = 0;
	for (int i = 0; i <= n; i++){
		ll gapone = i;
		ll gaptwo = (i + 1);
		//turns
		int turn = min(gapone, (n + 1) - gaptwo);
		//go left, turn on all right
		if (gapone > turn && (n + 1 - gaptwo)>=turn){
			answer = max(answer, dxprime[gapone] - dx[gapone - turn - 1] + dy[(n + 1) - gaptwo] - dy[(n + 1) - gaptwo - turn]);
		}
		//go left turn on all left
		if (gapone >= turn && (n + 1 - gaptwo) >= turn){
			answer = max(answer, dx[gapone] - dx[gapone - turn] + dyprime[(n + 1)-gaptwo] - dy[(n + 1)-gaptwo - turn]);
		}
		//go right turn on all right
		if (gapone >= turn && (n + 1 - gaptwo) >= turn){
			answer = max(answer, dxprime[gapone] - dx[gapone - turn] + dy[(n + 1) - gaptwo] - dy[(n + 1) - gaptwo - turn]);
		}
		//go right turn on all left
		if (gapone >= turn && (n + 1 - gaptwo) > turn){
			answer = max(answer, dx[gapone] - dx[gapone - turn] + dyprime[(n + 1) - gaptwo] - dy[(n + 1) - gaptwo - turn - 1]);
		}
	}
	printf("%lld\n", answer);
	
}

Measured memory_bytes: 9600
import math
import collections
import fractions
import itertools

def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    c = collections.Counter(a).most_common()
    c.reverse()
    ans = 0
    for i in range(max(len(set(a))-k, 0)):
        ans += c[i][1]
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 42312
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <unordered_map>

int main()
{
	unsigned long long N = 0;
  	std::uint64_t ans = 0;

	std::cin >> N;

	std::unordered_map<std::string, long long> mp;

	for (long long i = 0; i < N; i++)
	{
      	std::string S;
		std::cin >> S;
		std::sort(S.begin(), S.end());
		mp[S] += 1;
	}

	for(auto& s : mp) {
		ans += s.second * (s.second - 1) / 2;
	}

	std::cout << ans << std::endl;

	return 0;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	int x[100];

	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> x[i];

		sum += min(x[i] * 2, (k - x[i]) * 2);
	}

	cout << sum << endl;

	return 0;
}

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

int main(){
	string s;
	cin>>s;
	if(s=="Sunny"){
		cout<<"Cloudy"<<endl;
	}else if(s=="Cloudy"){
		cout<<"Rainy"<<endl;
	}else{
		cout<<"Sunny"<<endl;
	}
	return 0;
}

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

int main(){
    int K,S;
    cin >> K >> S;
    long int match = 0;
    for (int i=0;i<=K;i++) {
        for (int j=0;j<=K;j++) {
            int k = S - (i + j);
            if (k>=0&&k<=K) match++;
        }
    }
    cout << match << endl;
}

Measured memory_bytes: 256
#include <iostream>                                                             
#include <limits>                                                               
                                                                                
using namespace std;                                                            
                                                                                
int digitsum(int n) {                                                           
  if (n >= 10) {                                                                
    return (n % 10) + digitsum(n / 10);                                         
  } else {                                                                      
    return n;                                                                   
  }                                                                             
}                                                                               
                                                                                
int main(void) {                                                                
  int N;                                                                        
  int minval = numeric_limits<int>::max();                                      
  cin >> N;                                                                     
                                                                                
  for (int a = 1; a < N; a++) {                                                 
    int b = N - a;                                                              
    minval = min(minval, digitsum(a) + digitsum(b));                            
  }                                                                             
  cout << minval << endl;                                                       
  return 0;                                                                     
}     

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
//#define EPS 0.000000001
using namespace std;

#define EPS 0.000000000001


#define MAX 25

typedef vector<double> V;
typedef vector<V> MATRIX;
ll A,M,B,N;
ll SIZE;
ll nCm[MAX][MAX];

ll calc_pow(ll num,ll count){

	if(count == 0)return 1;
	if(count == 1)return num;

	ll ret;

	if(count%2 == 0){

		ret = calc_pow(num,count/2);
		ret = ret*ret;

	}else{

		ret = calc_pow(num,(count-1)/2);
		ret = ret*ret;
		ret *= num;
	}

	return ret;
}

void gauss_jordan(MATRIX matrix){

	MATRIX C(SIZE,V(SIZE+1));

	for(int row = 0; row < SIZE; row++){
		for(int col = 0; col <= SIZE; col++){
			C[row][col] = matrix[row][col];
		}
	}

	int base_row;
	double tmp;

	for(int i = 0; i < SIZE; i++){

		base_row = i;

		for(int row = i+1; row < SIZE; row++){
			if(fabs(C[row][i]) > fabs(C[base_row][i])){
				base_row = row;
			}
		}

		if(fabs(C[base_row][i]) < EPS)continue;

		if(base_row != i)swap(C[base_row],C[i]);

		tmp = C[i][i]; //係数
		for(int col = 0; col <= SIZE; col++){
			C[i][col] /= tmp;
		}

		for(int row = 0; row < SIZE; row++){
			if(row == i || fabs(C[row][i]) < EPS)continue;

			tmp = C[row][i];

			for(int col = i; col <= SIZE; col++){
				C[row][col] -= C[i][col]*tmp;
			}
		}
	}

	printf("%lld",ll(round(C[0][SIZE])));

	for(int row = M*N; row > 0; row--){

		printf(" %lld",ll(round(C[row][SIZE])));
	}
	printf("\n");
}

void func(){

	SIZE = M*N+1;

	MATRIX matrix(SIZE,V(SIZE+1));

	for(int row = 0; row < SIZE; row++){
		for(int col = 0; col <= SIZE; col++){
			matrix[row][col] = 0.0;
		}
	}

	matrix[0][0] = 1.0;
	matrix[0][SIZE] = 1.0;

	for(ll dim = 0; dim <= N*M; dim++){
		for(ll i = 0; i <= dim; i++){

			ll add = nCm[dim][i];
			add *= calc_pow(A,i/M)*calc_pow(B,(dim-i)/N);

			ll row = (i%M)*N+(dim-i)%N+1;
			ll col;

			if(dim < M*N){

				col = dim+1;

			}else{ //dim == M*N

				col = 0;
			}

			matrix[row][col] += add;
		}
	}

	gauss_jordan(matrix);
}

void make_table(){

	nCm[0][0] = 1;
	for(ll n = 1; n <= MAX-1; n++) {
		for (int m = 0; m <= n; m++) {
			if(m > 0){
				nCm[n][m] = nCm[n-1][m]+nCm[n-1][m-1];
			}else{ //m == 0
				nCm[n][m] = 1;
			}
		}
	}
}

int main(){

	make_table();

	while(true){

		scanf("%lld %lld %lld %lld",&A,&M,&B,&N);
		if(A == 0 && M == 0 && B == 0 && N == 0)break;

		func();
	}

	return 0;
}




Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

int main(){
fastio();


    int n;
    cin>>n;
    ll arr[n];
    ll xr=0LL;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        xr^=arr[i];
    }

    for(int i=0;i<n;i++)
    {
        cout<<(xr^arr[i])<<" ";
    }










return 0;
}



Measured memory_bytes: 5172
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

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

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 200'000 + 5;

i64 n, k;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    cin >> n;

    vector<i64> a(n + 1);
    for (i64 i = 0; i < n; i++) {
        cin >> a[i];
    }

    i64 m = 1000;
    i64 s = 0;

    i64 R = m;

    for (i64 i = 0; i < n; i++) {
        if (a[i] < a[i + 1]) {
            i64 c = m / a[i];
            m -= a[i] * c;
            s += c;
        }
        if (a[i] > a[i + 1]) {
            m += a[i] * s;
            s = 0;
        }

        R = max(R, m + a[i] * s);
    }

    cout << R << endl;

    return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,t,a,ans = 1;
    cin >> n >> t >> a;
    vector<int> h(n);
    for(int i = 0;i < n;i ++){
        cin >> h[i];
    }
    int m = abs(1000*a-1000*t+h[0]*6);
    for(int i = 1;i < n;i ++){
        int x = abs(1000*a-1000*t+h[i]*6);
        if(x < m){
            m = x;
            ans = i+1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
/*
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,   /// greater<T> for sorting decreasingly
    rb_tree_tag, tree_order_statistics_node_update>;
*/

#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         SET(m)                      memset(m, 1,sizeof m)
#define         RESET(m)                    memset(m,0,sizeof m)
#define         mp(a,b)                     make_pair(a,WWb)
#define         mod                         1000000007
#define         INF                         1e17
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;

ll f(ll n){
    if(n==1) return 1;
    else{
        return (1+2*f(n/2));
    }
}
int main(){
    ll n;
    sfl(n);
    ll ans= f(n);  
    cout << ans << endl; 
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;

const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 1, 0,-1};
const int dy4[6] = {-1, 0, 1,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};
void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}

ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 6e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1000000007;
/*************************************************************************/

void solve() {
    ll a,b,c;
    cin>>a>>b>>c;
    ll x = 4 * a * b;
    if(c - (a + b) < 0 ) {
        puts("No");
        return;
    }
    ll y = (c - (a + b) ) * (c - (a + b) );
    if(x < y) {
        puts("Yes");
    } else {
        puts("No");
    }
}


int main()
{
// #ifndef ONLINE_JUDGE
//   freopen("i.txt", "r", stdin);
//   freopen("o.txt", "w", stdout);
// #endif
  solve();
  return 0;
}





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

int main() {
  int N, res = 0, tmp;
  cin >> N;
  tmp = N;

  while (tmp > 0) {
    res += tmp % 10;
    tmp /= 10;
  }

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

Measured memory_bytes: 256
n = int(input())
p1 = p2 = 0
for _ in range(n):
    taro,hanako = map(str,input().split(" "))
    if taro>hanako: p1 += 3
    elif taro<hanako: p2 += 3
    else:
        p1 += 1
        p2 += 1
print(p1,p2)



Measured memory_bytes: 5596
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 1e8;
const double EPS = 1e-8;
const int MOD = 1000000007;
typedef pair<int, int> P;

P operator -(P p, P q){
  return P(p.first - q.first, p.second - q.second);
}

int distP(P p, P q){
  return abs(p.first - q.first) + abs(p.second - q.second);
}

int inner(P p, P q){
  return p.first * q.first + p.second * q.second;
}
int cross(P p, P q){
  return p.first * q.second - p.second * q.first;
}

bool ok(P p, P q){
  assert(p.first == 0 || p.second == 0);
  assert(q.first == 0 || q.second == 0);
  return (inner(p, q) > 0 && cross(p, q) == 0) || (inner(p, q) == 0 && cross(p, q) > 0);
}

int main(){
  assert(P(3, 1) - P(2, 10) == P(1, -9));
  assert(!ok(P(2, 0), P(0, -2)));
  assert(!ok(P(2, 0), P(-2, 0)));
  assert(ok(P(2, 0), P(2, 0)));
  assert(ok(P(2, 0), P(0, 2)));
  int M, N;
  while(cin>>M>>N && M){
    map<string, int> id_inter;
    vector<P> inter_p(M);
    REP(i, M){
      string inter; int x, y;
      cin>>inter>>x>>y;
      int t = i;
      //int t = id_inter.size();
      id_inter[inter] = t;
      inter_p[t] = P(x, y);
    }
    vector<int> connect[1000];
    REP(i, N){
      string inter1, inter2;
      cin>>inter1>>inter2;
      int id1 = id_inter[inter1];
      int id2 = id_inter[inter2];
      connect[id1].push_back(id2);
      connect[id2].push_back(id1);
    }
    string src, dst; cin>>src>>dst;
    int from = id_inter[src];
    int to = id_inter[dst];
    P dist[1000][1000];
    REP(i, M)REP(j, M) dist[i][j] = P(-1, -1);
    queue<P> que;
    FORIT(it, connect[from]){
      que.push(P(from, *it));
      dist[from][*it] = P(distP(inter_p[from], inter_p[*it]), 2);
    }
    P ans = P(INF, INF);
    while(!que.empty()){
      P p = que.front(); que.pop();
      P state = dist[p.first][p.second];
      if(p.second == to){
        ans = min(ans, state);
      }
      FORIT(it, connect[p.second]){
        P p1 = inter_p[p.second] - inter_p[p.first];
        P p2 = inter_p[*it] - inter_p[p.second];
        if(ok(p1, p2)){
          P next = P(state.first + distP(P(0, 0), p2), state.second + 1);
          if(dist[p.second][*it] != P(-1, -1) && dist[p.second][*it] <= next){
            continue;
          }
          dist[p.second][*it] = next;
          que.push(P(p.second, *it));
        }
      }
    }
    if(ans != P(INF, INF)) cout<<ans.second<<endl;
    else cout<<"impossible"<<endl;
    assert(id_inter.size() == M);
  }
  return 0;
}

Measured memory_bytes: 9260
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;

const int inf = int(1e9);
const int mod = inf + 7;
const int N = 5e5 + 555;


void solve()
{
	int n;
	cin >> n;
	cout << (n - 2) * 180;

}
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	Red;
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define F(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RF(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
#define SIEVELIM 10000000+10
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
inline int nextint(){ int temporary; scanf("%d",&temporary); return temporary; }
inline ll nextll(){ ll temporary; scanf("%lld",&temporary); return temporary; }
inline double nextdouble(){double temporary; scanf("%lf",&temporary); return temporary;}
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll leftChild(ll p ){return p<<1;}
ll rightChild(ll p ){return (p<<1)+1;}
inline ll mid(ll l, ll r){ return (l+r)/2;}
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define deb(x )     cerr << #x << " here "<< x; 
#define endl    "\n"
#define pb push_back
#define mp make_pair
#define all(cc) (cc).begin(),(cc).end()

inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }

template<typename T > void modulize(T & a, const T & b) { if (a >= b) { a %= b; } }
ll mulmod(ll a, ll b, ll m) { ll q = (ll)(((ld)a*(ld)b) / (ld)m); ll r = a*b - q*m; if (r>m)r %= m; if (r<0)r += m; return r; }
template <typename T, typename S>T expo(T e, S n) { T x = 1, p = e; while (n) { if (n & 1)x = x*p; p = p*p; n >>= 1; }return x; }
template <typename T>T power(T e, T n, T & m) { T x = 1, p = e; while (n) { if (n & 1)x = mod(x*p, m); p = mod(p*p, m); n >>= 1; }return x; }
template <typename T>T powerL(T e, T n, T & m) { T x = 1, p = e; while (n) { if (n & 1)x = mulmod(x, p, m); p = mulmod(p, p, m); n >>= 1; }return x; }
template <typename T> T InverseEuler(T a, T & m) { return (a == 1 ? 1 : power(a, m - 2, m)); }

inline int two(int n) { return 1 << n; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    
    int a,b;
    cin>>a>>b;

    if (a>8 || b>8)
    {
    	cout<<":(";
    } else {
    	cout<<"Yay!";
    }

    return 0;          
}/*
    
*/
 

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
double n,a[105],s,av,minv,ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		s+=a[i];
	}
	av=s/n;
	minv=99999;
	for(int i=1;i<=n;i++)
	{
		double d=a[i]-av;
		if(d<0)
			d=-d;
		if(d<minv)
		{
			minv=d;
			ans=i;
		}
	}
	cout<<ans-1;
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let mut result = 0;

    for x in k..=(n+1) {
        let x_min = ((x - 1) as f64 / 2.0 * x as f64) as usize;
        let x_max = x * n - x_min;
        let x_len = x_max - x_min + 1;
        result += x_len;
        result %= 1000000000 + 7;
    }

    println!("{}", result);
}


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

void sec_to_time(int S, int *hour, int *min, int *sec) {
    *hour = S / 3600;
    S %= 3600;
    *min = S / 60;
    S %= 60;
    *sec = S;
}

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

    int S, h, m, s;
    cin >> S;
    sec_to_time(S, &h, &m, &s);
    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3216
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#include<map>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){

  int n; cin >> n;
  vector<int> a(n); rep(i,n){cin >> a[i];}

  int max=a[0];int maxi=0;
  for (int i=1; i<n; i++){
    if (a[i]>max){max=a[i];maxi=i;}
  }

  rep(i,n){
    if (i!=maxi){cout << max << endl;}
    else {
      vector<int> b=a;
      b[i]=0;
      int second=b[0];
      for (int i=1; i<n; i++){
        if (b[i]>second){second=b[i];}
      }
      cout << second << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vi adj[100005];
ll dp[100005][2],visited[100005];
void dfs(int s){

    visited[s]=1;
    dp[s][0]=1,dp[s][1]=1;
    for(int i=0;i<adj[s].size();i++){
        if(visited[adj[s][i]]==0){
            dfs(adj[s][i]);
            dp[s][0]=(dp[adj[s][i]][0]+dp[adj[s][i]][1])*dp[s][0];
            dp[s][1]=dp[s][1]*dp[adj[s][i]][0];
            dp[s][0]%=hell;
            dp[s][1]%=hell;
        }
    }

    
}
int main(){
    int n,x,y;
    cin>>n;

    for(int i=1;i<n;i++){
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }

    memset(visited,0,sizeof visited);
    dfs(1);
    cout<<(dp[1][0]+dp[1][1])%hell;
}

Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);
using namespace std;

int main(){
  int n; 
  cin >> n;
  ll cnt=0;
  vector<ll>a(n),b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n){
    if(a[i]-b[i]>0)cnt-=a[i]-b[i];
    if(b[i]-a[i]>0)cnt+=(b[i]-a[i])/2;
  }
  if(cnt>=0)cout<<"Yes"<<endl;
  else cout <<"No"<<endl;
  return 0;
}

Measured memory_bytes: 384
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))


N = int(input())
for i in range(N):
  bingo_num = int(input())
  if bingo_num in A1:
    A1[A1.index(bingo_num)] = 0
  if bingo_num in A2:
    A2[A2.index(bingo_num)] = 0
  if bingo_num in A3:
    A3[A3.index(bingo_num)] = 0
if A1.count(0) == 3 or A2.count(0) == 3 or A3.count(0) == 3\
or A1[0]+A2[0]+A3[0] == 0 or A1[1]+A2[1]+A3[1] == 0 or A1[2]+A2[2]+A3[2] == 0\
or A1[0]+A2[1]+A3[2] == 0 or A1[2]+A2[1]+A3[0]==0:
  print("Yes")
else:
  print("No")

  
    
      
    
  

Measured memory_bytes: 3064
s = input()
keta = len(s)
mod = 10 ** 9 + 7
dp = [[0] * (13) for _ in range(keta + 1)]
dp[0][0] = 1
for i in range(keta):
    if s[i] == "?":
        num = -1
    else:
        num = int(s[i])
    ni = i + 1
    juu = pow(10, keta - 1 - i, 13)
    for j in range(13):
        nj = j
        if num == -1:
            for d in range(10):
                nj = j + d * juu
                nj %= 13
                dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
                continue
        else:
            nj = j + num * juu
            nj %= 13
            dp[ni][nj] += dp[i][j]
            dp[ni][nj] %= mod
print(dp[keta][5])


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

int main() {
	long long n, a, b; cin >> n >> a >> b;
	if (a > b) { cout << 0 << endl; return 0; }
	if (a != b && n == 1) { cout << 0 << endl; return 0; }
	if (a == b && n == 1) { cout << 1 << endl; return 0; }

	long long ans = (b - a) * (n - 2) + 1;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, h[N];
int main () {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
	int ans = 0;
	for (int i = n, j = -1; i; i--) {
		if (i < n && h[i + 1] > h[i]) j = 0;
		else j++;
		ans = max(ans, j);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
def sum_axis(input_list):
    x_sum, y_sum, z_sum = 0, 0, 0
    for i in input_list:
        x_sum += i[0]
        y_sum += i[1]
        z_sum += i[2]

    return x_sum, y_sum, z_sum

N, M = map(int, input().split(' '))

if M == 0:
    print(0)
    exit()

xyz = []
for i in range(N):
    xyz.append(list(map(int, input().split(' '))))

signs = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1],
        [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]
results = []

for sign in signs:
    sorted_list = sorted(xyz, key = lambda x: sign[0] * x[0] + sign[1] * x[1] + sign[2] * x[2])

    tmp = sum_axis(sorted_list[-M:])
    results.append(tmp[0] * sign[0] + tmp[1] * sign[1] + tmp[2] * sign[2])

print(max(results))

Measured memory_bytes: 3376
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
const int MaxN = 500;
using namespace std;
char s[10], res[MaxN + 5][MaxN + 5];
bool vis[4 * MaxN + 5][5];
int n, m, d;
string len = "RYGB";
int main() 
{
	while(~scanf("%d%d%d", &n, &m, &d)) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				int x = ((i + j) % (2 * d) + 2 * d) % (2 * d) / d;
				int y = ((i - j) % (2 * d) + 2 * d) % (2 * d) / d;
				putchar(len[2 * x + y]);
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 512
N,K,Q=map(int,input().split())
alist=list(map(int,input().split()))

def div_by_a(border,dlist):
  divided_list=[]
  div=[]
  for d in dlist:
    if d<border:
      if len(div)>0:
        div.sort()
        divided_list.append(div)
        div=[]
    else:
      div.append(d)
  else:
    if len(div)>0:
      div.sort()
      divided_list.append(div)
      
  return divided_list

answer=10**9
for a in alist:
  divlist=div_by_a(a,alist)
  #print(divlist)
  
  cand_list=[]
  for div in divlist:
    cand_num=max(0,len(div)-K+1)
    cand_list.extend(div[:cand_num])
    
  cand_list.sort()
  #print(cand_list)
  if len(cand_list)>=Q:
    answer=min(answer,cand_list[Q-1]-a)   
    
print(answer)

Measured memory_bytes: 3316