akhauriyash/Code-Regression huggingface dataset:
// Marcin Knapik
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)

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

#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll BIG_INF = 1e18+7;
const ll N = 1e6+7;
const ll T = 1<<20;

const ld eps = 1e-12;

ll n, m, k, q;

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

    string s;
    cin >> s;
    cin >> k;

    string xd = s;
    sort(all(xd));
    if(xd[0] == xd.back()){
        cout << ((ll) sz(s)) * k / 2 << '\n';
        exit(0);
    }
    vi przedz;
    s.pb('#');

    int last = 0;
    char last_char = s[0];
    for(int i = 0; i < sz(s); i++){
        if(s[i] != last_char){
            przedz.pb(i - last);
            last = i;
        }
        last_char = s[i];
    }
    s.pop_back();
    // cout << przedz << endl;

    if(s[0] == s.back()){
        ll suma = 0;
        for(int i = 1; i < sz(przedz) - 1; i++)
            suma += (przedz[i] / 2) * k;
        cout << suma + ((przedz[0] + przedz.back()) / 2) * (k - 1) + przedz[0] / 2 + przedz.back() / 2 << '\n';
    }
    else{
        ll suma = 0;
        for(int i = 0; i < sz(przedz); i++)
            suma += (przedz[i] / 2) * k;
        cout << suma << '\n';
    }
}   

Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

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

    int N; cin >> N;

    vector<pair<size_t, bool>> vec[N];
    for (size_t i = 0; i < N; ++i) {
        size_t A; cin >> A;
        for (size_t j = 0; j < A; ++j) {
            size_t x, y; cin >> x >> y; x--;
            vec[x].emplace_back(i, y);
        }
    }

    int maxv = 0;
    for (size_t bit = 0; bit < (1 << N); ++bit) {

        vector<bool> p(N, false);

        for (size_t i = 0; i < N; ++i) {
            if (bit & (1 << i)) {
                p[i] = true;
            }
        }

        bool flag = true;
        for (size_t i = 0; i < N; ++i) {
            if (p[i]) {
                for (auto e: vec[i]) {
                    if (!e.second && p[e.first]) {
                        flag = false;
                        break;
                    }
                }
            } else {
                for (auto e: vec[i]) {
                    if (e.second && p[e.first]) {
                        flag = false;
                        break;
                    }
                }
            }
        }

        if (flag) {
            chmax(maxv, __builtin_popcount(bit));
        }
    }

    cout << maxv << "\n";

    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; i+=2){
        int cnt = 0;
        for(int j = 1; j <= N; j++){
            if(i % j == 0) cnt++;
        }
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
long long a,b,k;
main()
{
    scanf("%lld%lld%lld",&k,&a,&b);
    if(k<=a)return puts("1"),0; 
    else if(a<=b)return puts("-1"),0;   
    else printf("%lld\n",((k-a)/(a-b)+bool((k-a)%(a-b)))<<1|1);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long min=10000000,max=-1000000,sum=0;
		int n=scan.nextInt();
		int a[]=new int[10000];
		int x;
			for(x=0;x<n;x++) {
				int i=scan.nextInt();
				a[x]=i;
			}
				for(x=0;x<n;x++) {
					if(a[x]<min) {
						min=a[x];
					}if(a[x]>max) {
						max=a[x];
					}
					sum +=a[x];
					}
			System.out.printf("%d %d %d\n",min,max,sum);
		scan.close();
}
}


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

int main()
{
    ll n,sum=0,k;cin>>n>>k;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(int i=0;i<k;i++)
        sum+=arr[i];
    cout<<sum;

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve(){
		UL N; cin >> N;
		vector<pair<UL, UL>> ans;
		vector<vector<UL>> G;
		if (N & 1) G.push_back({ N });
		UL Np = N / 2 * 2;
		rep(i, N / 2) G.push_back({ i + 1, Np - i });
		rep(i, G.size() - 1) {
			for (UL a : G[i]) for (UL b : G[i + 1]) {
				ans.push_back({ a, b });
			}
		}
		if(G.size() > 2) for (UL a : G.back()) for (UL b : G[0]) ans.push_back({ a, b });
		cout << ans.size() << endl;
		rep(i, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

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

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

  int a[N];
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a[i] = tmp-1;
  }

  int idx = 0;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if(a[i]==idx) {
      idx++;
    } else {
      ans++;
    }
  }

  cout << ((idx!=0)? ans: -1) << endl;

  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flag = false;
        for(int i = 0; i <= N; i++){
            for (int j = 0; j <= N - i; j++) {
                if(10000 * i + 5000 * j + 1000 * (N - i - j) == Y){
                    System.out.println(i+" "+j+" "+(N - i - j));
                    flag = true;
                    break;
                }
            }
            if(flag){
                break;
            }
        }
        if(!flag){
            System.out.println("-1 -1 -1");
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    long long ans1,ans2,ans3,ans4;
    ans1 = a*c;
    ans2 = a*d;
    ans3 = b*c;
    ans4 = b*d;
    long long ans = max(ans1,ans2);
    ans = max(ans,ans3);
    ans = max(ans,ans4);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool f[6001][6001],g[6001][6001];
int a[6001],s[6001][6001],i,j,k,n,m,ans;
int main(){
	scanf("%d%d",&n,&m);memset(f,0,sizeof(f));memset(g,0,sizeof(g));
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1,f[0][0]=1;i<=n;i++)
	 for (j=m;j>=0;j--){
	 	f[i][j]=f[i-1][j];
		if (j>=a[i]) f[i][j]|=f[i-1][j-a[i]];
	 }
	for (i=n,g[n+1][0]=1;i;i--){
		for (j=m;j>=0;j--){
			g[i][j]=g[i+1][j];
			if (j>=a[i]) g[i][j]|=g[i+1][j-a[i]];
		}
		for (j=0,s[i][0]=0;j<=m;j++) s[i][j+1]=s[i][j]+g[i][j];
	}
	for (i=1,s[n+1][0]=0;i<=m+1;i++) s[n+1][i]=1;
	for (i=1,ans=0;i<=n;i++){
		for (k=0,j=0;j<=m;j++)
		 if (f[i-1][j]&&(s[i+1][m-j]-s[i+1][max(m-j-a[i],0)])){
		 	k=1;break;
		 }
		if (!k) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 190720
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
 
 
int main ()
{
  prep();
  string s;
  cin >> s;
  int cnts[26] = {0};
  for (int i=1; i<s.size(); i++){
      if (s[i] == s[i-1]){
          cout << i << " " << i+1;
          return 0;
      }
      
  }
  for (int i=1; i<s.size()-1; i++){
      if (s[i-1] == s[i+1]){
          cout << i << " " << i+2;
          return 0;
      }
      
  }
  cout << "-1 -1";
  
  return 0; 
}

Measured memory_bytes: 512
N = int(input())
L = []
for _ in range(N):
    L.append(int(input()))

dp_table = [None for _ in range(10**5+2)]
for i in range(len(L)):
    dp_table[L[i]] = [0 for _ in range(N)]
    dp_table[L[i]][i] +=  1
import copy
for i in range(10**5+2):
    if dp_table[i] != None:
        for j in range(N):
            if dp_table[i][j] == 0:
                tmp = copy.copy(dp_table[i])
                tmp[j] += 1
                dp_table[i+L[j]] = tmp
ans = 0
for i in range(10**5+1):
    if dp_table[i] != None and i % 10 != 0:
        ans = max(ans, i)

print(ans)

Measured memory_bytes: 50080
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] arr = ScannerUtils.readIntArray(in, n);

            Arrays.sort(arr);

            if (n % 2 == 0) { //even
                int next = 1;
                for (int i = 0; i < arr.length; i += 2) {
                    if (arr[i] == next && arr[i + 1] == next) {
                        next += 2;
                    } else {
                        out.println(0);
                        return;
                    }
                }

            } else { //odd
                if (arr[0] != 0) {
                    out.println(0);
                    return;
                }

                int next = 2;
                for (int i = 1; i < arr.length; i += 2) {
                    if (arr[i] == next && arr[i + 1] == next) {
                        next += 2;
                    } else {
                        out.println(0);
                        return;
                    }
                }
            }

            int pow2 = n / 2;
            int res = 1;
            while (pow2-- > 0) {
                res = (res * 2) % 1_000_000_007;
            }
            out.println(res);
        }

    }

    static class ScannerUtils {
        public static int[] readIntArray(Scanner in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 48848
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 300000


int main(){
	int a[N + 1];
	int b[N + 1];
	char c[N+1];
	int n, ans;
	scanf("%d", &n);
	ans = n;
	a[0] = 0;
	b[0] = 0;
  		scanf("%s", c);
	for (int i = 0; i < n; i++){
		if (c[i] == 'E'){
          a[i + 1] = a[i] + 1;
          b[i+1]=b[i];
        }
		else {
b[i + 1] = b[i] + 1;
          a[i+1]=a[i];
        }
	}
	for (int i = 0; i < n; i++){
		if ((b[i] - a[i + 1] + a[n]) < ans)ans = b[i] - a[i + 1] + a[n];
	}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
 
int main(){
  int m;
  cin >> m;
 
  while(m--){
    string train;
    cin >> train;
    set<string> st;
    for( int i = 1, length = train.length() ; i < length ; ++i ){
      string f, b;
      f = train.substr(0,i);
      b = train.substr(i, length-i);
      st.insert(f+b);
      st.insert(b+f);
      reverse(b.begin(), b.end());
      st.insert(f+b);
      st.insert(b+f);
      reverse(f.begin(), f.end());
      st.insert(f+b);
      st.insert(b+f);
      reverse(b.begin(), b.end());
      st.insert(f+b);
      st.insert(b+f);
    }
    cout << st.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 1288
#include <iostream>

using namespace std;

int main()
{
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;

  X *= 2;
  Y *= 2;

  int common = min(X,Y);
  int price = 0;
  
  {
    int price_C = common * C;
    int price_AB = common/2 * (A+B);
    price += min(price_C, price_AB);
  }
  
  if (X>Y) {
    int residue_X = X - common;
    int price_A = residue_X/2 * A;
    int price_C = residue_X * C;
    price += min(price_A,price_C);
  } else if (Y>X) {
    int residue_Y = Y - common;
    int price_B = residue_Y/2 * B;
    int price_C = residue_Y * C;
    price += min(price_B,price_C);
  }

  cout << price << endl;
  
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N, X, Y = map(int, input().split())
    dic = {key: 0 for key in range(1, N)}
    for i in range(1, N+1):
        for j in range(1, N+1):
            if(i < j):
                key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
                dic[key] += 1
    for ans in dic.values():
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 46428
((stdin) => {
	let [x, y] = stdin.split(' ');
	let tsuru = +x * 2 - +y / 2;
	if (tsuru >= 0 && tsuru <= +x && +y % 2 === 0) {
		console.log('Yes');
	} else {
		console.log('No');
	}
})(require("fs").readFileSync("/dev/stdin", "UTF-8"));

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

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


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


int main(){
	for (double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; ) {
		double z = a * e - b * d;
		double x = (c * e - b * f) / z;
		double y = (a * f - c * d) / z;
		if (fabs(x) < EPS) x = 0;
		if (fabs(y) < EPS) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 0
n = gets.to_i
t,a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)

best = 10**10
best_i = nil
n.times do |i|
  temp = t - h[i] * 0.006
  diff = (a-temp).abs
  if diff < best
    best = diff
    best_i = i
  end
end

puts best_i+1

Measured memory_bytes: 1788
using System;
using System.Linq;

namespace TestProject20180923
{
    class Program
    {
        static void Main(string[] args)
        {
            var vs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var xs = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var ys = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            xs.Add(vs[2]);
            ys.Add(vs[3]);
            if(xs.Max() < ys.Min())
            {
                Console.WriteLine("No War");

            }
            else
            {
                Console.WriteLine("War");
            }
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int count = 0;
        n -= k;
        count++;
        count += (n + k - 2) / (k-1);
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e18+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    vector<vector<int>> a(h,vector<int>(w));
    rep(i,0,h) rep(j,0,w) cin >> a[i][j];
    rep(i,0,h) rep(j,0,w){
        int b; cin >> b;
        a[i][j] = abs(a[i][j]-b);
    }
    vector<vector<bitset<25610>>> dp(h,vector<bitset<25610>>(w));
    int mid = 12805;
    dp[0][0][mid+a[0][0]] = 1;
    dp[0][0][mid-a[0][0]] = 1;
    rep(i,0,h){
        rep(j,0,w){
            if(i+1<h){
                dp[i+1][j] |= (dp[i][j]<<a[i+1][j]) | (dp[i][j]>>a[i+1][j]);
            }
            if(j+1<w){
                dp[i][j+1] |= (dp[i][j]<<a[i][j+1]) | (dp[i][j]>>a[i][j+1]);
            }
        }
    }
    rep(i,0,mid){
        if(dp[h-1][w-1][mid+i]|dp[h-1][w-1][mid-i]){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 20736
/*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) cin >> as[i];

  int cnt = 0;

  // Bubble sort
  for (int i = 0; i < n; i++)
    for (int j = n - 1; j >= i + 1; j--)
      if (as[j] < as[j - 1]) {
	swap(as[j], as[j-1]);
	cnt++;
      }

  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    printf("%d", as[i]);
  }
  putchar('\n');
  printf("%d\n", cnt);

  return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
int w,h;

void solve(int w,int h){
	int ng[32][32][4]={};
	int flag[32][32]={};
	int tmp;
	bool breakflag=0;
	for(int i=0;i<2*h-1;i++){
		if(i%2==0){
			for(int j=0;j<w-1;j++){
				cin >> tmp;
				ng[j][i/2][3]=tmp;
				ng[j+1][i/2][2]=tmp;
			}
		}
		if(i%2==1){
			for(int j=0;j<w;j++){
				cin >> tmp;
				ng[j][i/2][0]=tmp;
				ng[j][i/2+1][1]=tmp;
			}
		}
	}
	queue<pair<int,pair<int,int> > > q;
	q.push(make_pair(1,make_pair(0,0)));
	flag[0][0]=1;
	while(!q.empty()){
		pair<int,pair<int,int> >p;
		p = q.front();
		q.pop();
		int a,b;
		a = p.second.first;
		b = p.second.second;
		if(a==w-1&&b==h-1){
			cout << p.first <<endl;
			breakflag=1;
			break;
		}
		for(int i=0;i<4;i++){
			if(a+dx[i]>=0&&a+dx[i]<w&&b+dy[i]>=0&&b+dy[i]<h){
				if(ng[a][b][i]==0&&flag[a+dx[i]][b+dy[i]]==0){
					q.push(make_pair(p.first+1,make_pair(a+dx[i],b+dy[i])));
					flag[a+dx[i]][b+dy[i]]=1;
				}				
			}
		}
	}
	if(breakflag==0){
		cout << 0 <<endl;
	}
}


int main(){
	while(1){
		cin >> w >> h;
		if(w==0&&h==0)break;
		solve(w,h);
	}
	return 0;
}

Measured memory_bytes: 2996
import sys
INF = 10 ** 15
MOD = 10 ** 9 + 7
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
from math import pi
from functools import lru_cache

def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    dp = [[0,1] + [0] * k for _ in range(n + 1)]

    for i in range(n):
        m = a[i]
        for j in range(k + 1):
            dp[i][j + 1] += dp[i][j]
            dp[i][j + 1] %= MOD
        for j in range(1,k + 1):
            dp[i + 1][j + 1] = dp[i][j + 1] - dp[i][max(j - m,0)]
            dp[i + 1][j + 1] %= MOD
    
    print(dp[-1][-1])

if __name__ =='__main__':
    main()    

Measured memory_bytes: 137372
#include<complex>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
using namespace std;
#define fr first
#define sc second

struct line: public vector< complex<double> >{
  line(){};
  line( const complex<double>& a, const complex<double>& b){
    push_back(a);
    push_back(b);
  }
};
struct circle {
  complex<double> p; double r;
  circle():p(0,0),r(0){};
  circle(const complex<double> &p, double r) : p(p),r(r){}
};

typedef complex < double > P;
typedef line               L;
typedef vector< L >        LLL;
typedef vector< P >        Ps;
typedef circle             C;
const double EPS = 1e-9;
const double INF = 1e8;

double cross( P a, P b){
  return imag( conj(a) * b);
}
double dot( P a, P b){
  return real( conj(a) * b);
}
int ccw( P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > EPS)    return 1;  // a → b で 時計方向におれて c
  if(cross(b,c) < -EPS)    return -1; // a → b で 反時計方向におれて c
  if(dot(b,c) < -EPS)      return 2;  // c -- a -- b
  if(norm(b) < norm(c) - EPS) return -2; // a -- b -- c
                        return 0;  // a -- c -- b
}
bool intersect( L a, L b){
  return ccw( a[0], a[1], b[0]) * ccw( a[0], a[1], b[1]) <= 0 &&
    ccw( b[0], b[1], a[0]) * ccw( b[0], b[1], a[1]) <= 0;
}
Ps crosspoint(C c1, C c2){
  double d = abs(c1.p - c2.p);
  double s = (c1.r + c2.r + d) / 2;
  double S = sqrt( s * ( s - c1.r) * ( s - c2.r) * ( s - d));
  double h = 2 * S / d;
  P v = ( c2.p - c1.p) / ( abs( c2.p - c1.p));
  double m = sqrt( c1.r * c1.r - h * h);
  Ps ret;
  ret.push_back( c1.p + m * v + h * v * P(0,1));
  ret.push_back( c1.p + m * v - h * v * P(0,1));
  return ret;
}
struct dC{
  double cost;
  P pos;
  int nowi,nowj;
  bool operator < (const dC &left) const {
    return cost > left.cost;
  }
};
L make_2_cross(C c1, C c2){
  Ps a(crosspoint( c1, c2));
  return L( a[0], a[1]);
}

int main(){
  C prev, now;
  int n;

  while(cin >> n , n){
    LLL ls;

    cin >> prev.p.real() >> prev.p.imag() >> prev.r;
    ls.push_back( L( prev.p, prev.p));

    for(int i = 1 ; i < n ; i++ ){
      cin >> now.p.real() >> now.p.imag() >> now.r;
      ls.push_back( make_2_cross( prev, now));
      prev = now;
    }
    ls.push_back( L( prev.p, prev.p)); // G

    priority_queue< dC > que;
    que.push((dC){ 0, ls[0][0], 0, 0});
    bool used[101][2] = {{}};
    double ret = INF;
    while(!que.empty()){
      dC p = que.top();
      que.pop();
      if(p.nowj == n){
        ret = p.cost;
        break;
      }
      if(used[p.nowj][p.nowi]++) continue;
      for(int i = 0 ; i < 2 ; i++ ){
        for(int j = p.nowj + 1 ; j <= n ; j++ ){
          L l = L( p.pos, ls[j][i]);

          bool flag = true;
          for(int k = j - 1 ; k > p.nowj ; k-- ){
            if(!intersect( l, ls[k])){
              flag = false;
              break;
            }
          }
          if(flag) que.push( (dC){ abs( l[0] - l[1]) + p.cost, l[1], i, j});
        }
      }
    }
    cout << fixed << setprecision(7) << ret << endl;
  }
}

Measured memory_bytes: 1364
#include <bits/stdc++.h>
using namespace std;
const int p = 2019;
typedef long long ll;
ll l,r,mini = 0x3f3f3f3f;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin >> l >> r;
    if(l/p != r/p) cout << 0;
    else {
        for(ll i = l;i <= r; ++i){
            for(ll j = i + 1;j <= r; ++j){
                mini = min(i*j%p,mini);
            }
        }
        cout << mini;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mods[] = {998244353, 1000000007, 1000000009};
const ll bases[] = {997, 1009, 1013};
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n,k;
vl a;
ll sum_a;
vl divisor;
ll ans;

bool solve(ll x){
  vl b = vl(n);
  for(ll i = 0;i < n;i++){
    b[i] = a[i]%x;
  }
  ll sum_b = accumulate(b.begin(),b.end(),0ll);
  ll cnt = sum_b/x;

  sort(b.rbegin(),b.rend());
  ll hoge = 0;
  for(ll i = 0;i < cnt;i++){
    hoge += x-b[i];
  }
  return hoge <= k;


}


int main(){
  cin >> n >> k;
  a = vl(n);
  for(ll i = 0;i < n;i++){
    cin >> a[i];
  }
  sum_a = accumulate(a.begin(),a.end(),0ll);
  for(ll i = 1;i*i <= sum_a;i++){
    if(sum_a%i == 0){
      divisor.push_back(i);
      divisor.push_back(sum_a/i);
    }
  }
  sort(divisor.begin(),divisor.end());
  for(ll x : divisor){
    if(solve(x)) ans = x;
  }
  cout << ans << endl;

}


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

using namespace std;
const int N = 1e6+100;
const long long INF = 999999999999;
long long dis[N][3];
vector<int> G[N];
bool vis[N][3];
struct node{
    int id;
    int  dis;
};
int n,m,S,T;
queue<node> q;
void dijkstra(int S){
    for(int i=1;i<=n+100;i++){
        for(int j=0;j<3;j++) dis[i][j]=INF,vis[i][j]=0;
    }
    dis[S][0]=0;
    q.push({S,0});
    while(!q.empty()){
        node rt=q.front();q.pop();
        int u=rt.id;
        int L=rt.dis;
        if(vis[u][L]) continue;
        vis[u][L]=1;
        for(auto v:G[u]){
            int nowL=(L+1)%3;
            if(dis[v][nowL]>dis[u][L]+1){
                dis[v][nowL]=dis[u][L]+1;
                q.push({v,nowL});
            }
        }
    }
}
int main(){
    cin>>n>>m;
    int u,v;
    for(int i=1;i<=m;i++){
        cin>>u>>v;
        G[u].push_back(v);
    }
    cin>>S>>T;
    dijkstra(S);
    //cout<<dis[T][0]<<endl;
    if(dis[T][0]==INF) puts("-1");
    else cout<<dis[T][0]/3<<endl;
    return 0;
}



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

using namespace std;
#define MAX 1000

struct Item{
  int value,weight;
};
int max;
int N,W;
Item items[MAX];
int H[MAX+1][MAX+1];//Óëµ«
int cc=1;

void compute(){
  for(int w=0;w<=W;w++) H[0][w]=0;
  for(int i=1;i<=N;i++) H[i][0]=0;
  
  for(int i=1;i<=N;i++){
    for(int w=1;w<=W;w++){
      if(items[i].weight <= w){
	if(items[i].value + H[i-1][w-items[i].weight] >  H[i-1][w]){
	  H[i][w] = items[i].value + H[i-1][w-items[i].weight];
	}
	else H[i][w]=H[i-1][w];
      }
      else H[i][w] = H[i-1][w];
    }
  }

}

void input(){
  cin >> N;
  for(int i=1;i<=N;i++){
    scanf("%d,%d", &items[i].value,&items[i].weight);
  }
}

void calc(){
  int sw=10000;//àÁÆà¿¢³¢wðÛ¶
  for(int i=1;i<=N;i++){
    for(int w=1;w<=W;w++){
      if(H[i][w] == H[N][W] && w<=sw){
	sw = w;
      }
    }
  }
  printf("Case %d:\n%d\n%d\n",cc,H[N][W],sw);  
}


int main(){

  int maxValue;
  while(cin >> W){
    if(W==0)break;
    input();
    compute();
    calc();
    cc++;


  }
}

Measured memory_bytes: 0
A_B = list(map(int, input().split()))

A = A_B[0]
B = A_B[1]

p_number = 0

for num in range(A, B + 1):
    num_list = [int(x) for x in list(str(num))]
    half = int(len(num_list) / 2)
    end = len(num_list)
    judge = 0
    for j in range(half):
        if num_list[j] == num_list[end - j - 1]:
            continue
        else:
            judge += 1

    if judge == 0:
        p_number += 1

print(p_number)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
    int s,m,h;
    cin >> s;
    h = s/3600;
    m = (s-h*3600)/60;
    s = s-h*3600-m*60;
    cout << h << ":" << m << ":" << s <<endl;
    return 0;
}


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

using namespace std;

//入力
int N,M;


int main(){
  cin >> N >> M;
  
  int a[M];
  int i,sum=0;
  
  for(i=0;i<M;i++){
    cin >> a[i];
    sum = sum + a[i];
  }
  
  if(sum <= N) cout << (N - sum) << endl;
  else cout << -1 << endl;
  
}

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

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    int sum = 0;
    for(int i = 0; i < 3; i++){
        if(S.at(i) == T.at(i)) sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string.h>
#define fornt(k,n) for(int i=k; i<n; ++i)
#define fornt2(p,n) for(int j=p; j<n; ++j)
#define pb push_back
#define ll long long
#define sc(n) scanf("%d",&n)
#define sc2(x,y) scanf("%d %d",&x,&y)
#define scl(n) scanf("%lld",&n)
#define scl2(x,y) scanf("%lld %lld",&x,&y)
#define pr(n) printf("%d\n",n)
#define prl(n) printf("%lld\n",n)
#define pry printf("YES\n")
#define prn printf("NO\n")
using namespace std;


int main ()
{
    int n,m,k,ans(0);
    sc2(n,m);
    sc(k);
    char a[n][m];
    fornt(0,n)
    {
        fornt2(0,m)
        {
            cin>>a[i][j];
        }
    }
    fornt(0,(1 << n))
    {
        fornt2(0,(1 << m))
        {
            int c=0;
            for(int c1 = 0; c1<n; c1++)
            {
                for(int c2 = 0; c2<m; c2++)
                {
                    if((i & (1 << c1)) && (j & (1 << c2)))
                    {
                        if(a[c1][c2]=='#')
                            ++c;
                    }
                }
            }
            if(c==k)
                ++ans;
        }
    }
    pr(ans);
}


Measured memory_bytes: 3232
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;

template <typename T>
struct RMQ {
    const T INF = numeric_limits<T>::max();
    int n;
    vector<T> dat, lazy;
    RMQ(int n_) : n(), dat(n_ * 4, INF), lazy(n_ * 4, INF) {
        int x = 1;
        while (n_ > x) x *= 2;
        n = x;
    }

    void eval(int k) {
        if (lazy[k] == INF) return;
        if (k < n - 1) {
            lazy[k * 2 + 1] = lazy[k];
            lazy[k * 2 + 2] = lazy[k];
        }
        dat[k] = lazy[k];
        lazy[k] = INF;
    }

    void update(int a, int b, T x, int k, int l, int r) {
        eval(k);
        if (a <= l && r <= b) {
            lazy[k] = x;
            eval(k);
        } else if (a < r && l < b) {
            update(a, b, x, k * 2 + 1, l, (l + r) / 2);
            update(a, b, x, k * 2 + 2, (l + r) / 2, r);
            dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    void update(int a, int b, T x) { update(a, b, x, 0, 0, n); }

    T query_sub(int a, int b, int k, int l, int r) {
        eval(k);
        if (r <= a || b <= l) {
            return INF;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {
            T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
    T query(int a, int b) { return query_sub(a, b, 0, 0, n); }

};
int main() {
    int N,Q;
    cin>>N>>Q;
    RMQ<int> row(N-2),column(N-2);
    ll black=(ll)(N-2)*(N-2);
    row.update(0,N-2,N-2);
    column.update(0,N-2,N-2);
    int leftmost=N-1;
    int top=N-1;
    for (int i = 0; i < Q; i++){
        int a,b; cin>>a>>b;
        b-=2;
        if(a==1){
            int tmp=column.query(b,b+1);
            black-=tmp;
            if(b<leftmost){
                row.update(0,tmp,b);
                leftmost=b;
            }
        }else{
            int tmp=row.query(b,b+1);
            black-=tmp;
            if(b<top){
                column.update(0,tmp,b);
                top=b;
            }
        }
    }
    cout<<black<<endl;
}

Measured memory_bytes: 15688
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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 (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vi V(N);
	REP(i, N) {
		cin >> V[i];
	}
	so(V);
	double ans = (V[0] + V[1])/2.0;
	FOR(i, 2, N) {
		ans = (ans + V[i]) / 2.0;
	}
	printf("%.7f\n", ans);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    String s = sc.nextLine().trim();

    String[] s1= new String[s.length() + 1];
    for (int i = 1;i < s1.length;i++) {
      s1[i] = s.substring(i-1,i);
    }
    int[] n = new int[s1.length];
    n[0] = 0;
    for (int i = 1;i < s1.length;i++) {
      if ("A".equals(s1[i])){
        n[i] = 1;
      } else if ("G".equals(s1[i])){
        n[i] = 1;
      } else if ("C".equals(s1[i])){
        n[i] = 1;
      } else if ("T".equals(s1[i])){
        n[i] = 1;
      }
    }
    for (int i = 1;i < s1.length;i++){
      if (n[i] ==1 ){
        n[i] = n[i-1] + 1;
      }
    }
    int max=0;
    for (int i = 1;i < n.length;i++) {
      max = Math.max(max,n[i]);
    }
    System.out.println(max);
  }

}


Measured memory_bytes: 21844
from math import sqrt
N = int(input())
v = int(sqrt(N)) + 1
ans = 100
for i in range(v, 0, -1):
    if N % i == 0:
        s1 = str(i)
        s2 = str(N // i)
        # print('s1 s2', s1, s2)
        new_ans = max(len(s1), len(s2))
        ans = min(new_ans, ans)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF=pow(10,9);

ll A,B,C;
vector<int> l;
int n;

ll Tmin(ll a, ll b, ll c)
{
  vector<int> v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  sort(v.begin(),v.end());
  return v[0];
}

ll Fmin(ll a, ll b, ll c, ll d)
{
  vector<ll> v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  v.push_back(d);
  sort(v.begin(),v.end());
  return v[0];
}

// a is equal to the sum of the length of the bomboos
// which are to consist in A
ll dfs(int num, ll a, ll b, ll c)
{
  if(num == n){
    ll tmp;
    if(Tmin(a,b,c)>0) tmp = abs(a-A)+abs(b-B)+abs(c-C)-30;
    else tmp = INF;
    return tmp;
  }
  ll tmp0,tmp1,tmp2,tmp3;
  tmp0 = dfs(num+1,a,b,c);
  tmp1 = dfs(num+1,a+l[num],b,c)+10;
  tmp2 = dfs(num+1,a,b+l[num],c)+10;
  tmp3 = dfs(num+1,a,b,c+l[num])+10;
  return Fmin(tmp0,tmp1,tmp2,tmp3);
}

int main()
{
  cin >> n >> A >> B >> C;
  for (int i = 0; i < n; i++)
  {
    int tmp;
    cin >> tmp;
    l.push_back(tmp);
  }
  cout << dfs(0,0,0,0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include  <vector>
using namespace std;
#define INF 0x3f3f3f3f
const int N = 1111;
int mod = 1e9 + 7;
typedef long long ll;


int main()  
{
   // freopen("in.txt", "r", stdin); 
    int a, b;
    while (~scanf("%d%d", &a, &b))
    {
        int ans;
       for (int i = 2; i <= 999; i++)
       {
        int l = i-1, r = i*(i+1)>>1;
        l = l*(l+1)>>1;
        if (l-a == r-b && (l-a) >= 0)
        {
            ans = l - a;
            break;
        }
       }
       printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 1000003
#define LL long long
#define mod 998244353

char s[10];

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	scanf("%s",s+1);
	if (s[1]=='S') puts("Cloudy");
	if (s[1]=='C') puts("Rainy");
	if (s[1]=='R') puts("Sunny");
	return 0;
}

Measured memory_bytes: 256
N, D = map(int, input().split())
A = []
for i in range(N):
    XY = list(map(int, input().split()))
    A.append(XY)

count = 0
for i in A:
    x = i[0]**2+i[1]**2
    if x <= D**2:
        count +=1
print(count)



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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

vector<string> split(string s){
	vector<string> ret;
	int idx = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == ':' || s[i] == ',' || s[i] == '.'){
			ret.push_back(s.substr(idx, i-idx));
			idx = i+1;
		}
	}
	return ret;
}

int groupidx(vector<string> &g, string &str){
	for(int i = 0; i < g.size(); i++){
		if(g[i] == str)return i;
	}
	return -1;
}


signed main(){
	while(true){
		int n; cin >> n;
		if( n == 0)break;
		vector<string> group;
		vector<set<string> > d;
		for(int i = 0; i < n; i++){
			string s; cin >> s;
			auto ss = split(s);
			group.push_back(ss[0]);
			d.push_back(set<string>());
			for(int i = 1; i < ss.size(); i++){
				d.back().insert(ss[i]);
			}
		}
//		for(auto e : group)cerr << e << " ";
//		cerr << endl;
//		for(auto v : d){for(auto e :v)cerr << e << " ";cerr << endl;}
//		cerr << "a" << endl;
		set<string> ans;
		set<int> used;
		stack<int> st;
		st.push(0);
		used.insert(0);
		while(!st.empty()){
			int i = st.top();
			st.pop();
			for(auto e : d[i]){
				auto idx = groupidx(group, e);
				if(idx != -1){
					if(used.find(idx) == used.end()){
						st.push(idx);
						used.insert(idx);
					}
				}
				else{
					ans.insert(e);
				}
			}
		}
		cout << ans.size() << endl;
	}

	return 0;
}




Measured memory_bytes: 3292
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int main()
{
     int a,b;
     while(cin>>a>>b)
     {
         cout<<(((a==2)|(b==2))?"No":"Yes")<<endl;;
     }

}
















Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    int a,b,c;
    cin >> a >> b >> c;
    if(a <= c && c <= b)cout << "Yes" << endl; else cout << "No" << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

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



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

    int cnt0 = 0;
    int cnt1 = 0;
    n = size(s);
    rep(i, n)
    {
        if (s.at(i) == '0') cnt0++;
        if (s.at(i) == '1') cnt1++;
    }
    if (cnt0 > cnt1) cout << cnt1*2 << endl;
    else cout << cnt0*2 << endl;

    return 0;
}


Measured memory_bytes: 3740
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/28/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int x; cin>>x;
  ll ans = x/500*1000;
  x = x%500;
  ans += x/5*5;
  cout << ans << endl;

  return 0;
}


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

namespace ConsoleApplication11 {
    class Program {

        const int MAX = 1000001;

        static void Main(string[] args) {
            new Program().solve();
        }


        void solve() {
            bool[] humming_List = new bool[MAX];
            for (int i = 1; i < MAX; i*=2) {
                for (int j = i; j < MAX; j *= 3) {
                    for (int k = j; k < MAX; k*=5) {
                        humming_List[k] = true;
                    }
                }
            }
            while (true) {
                var input = Console.ReadLine();
                if (input == "0") {
                    return;
                }
                int count = 0;
                for (int i = int.Parse(input.Split(' ')[0]); i <= int.Parse(input.Split(' ')[1]); i++) {
                    if (humming_List[i]) {
                        count++;
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}

Measured memory_bytes: 11104
#include<iostream>
using namespace std;
int main()
{
  int r,d,n;
  cin>>r>>d>>n;
  int x;
  x=n;
  for(int i=2000;i<=2009;i++)
  {
    x=x*r-d;
    cout<<x<<"\n";
  }
 
  return 0;
}

Measured memory_bytes: 256