akhauriyash/Code-Regression huggingface dataset:
def f(nc, nt, nq):
    dp = [[0] * (nc + 1) for _ in range(nc + 1)]
    for _ in range(nt):
        l,r=map(int, input().split())
        dp[l][r] += 1
    q = [list(map(int, input().split())) for _ in range(nq)]
    for i in range(1, nc + 1):
        dpi = dp[i]
        s = dpi[0]
        for j in range(1, nc + 1):
            dpi[j] = s = dpi[j] + s
    for j in range(1, nc + 1):
        s = dp[0][j]
        for i in range(1, nc + 1):
            dp[i][j] = s = dp[i][j] + s
    for l, r in q:
        print(dp[r][r] - dp[l - 1][r] - dp[r][l - 1] + dp[l - 1][l - 1])


nc, nt, nq = map(int, input().split())
f(nc, nt, nq)


Measured memory_bytes: 34748
#include<iostream>
    #include<vector>
    #include<math.h>
    #include<bits/stdc++.h>
    #include<sstream>
     
    using namespace std;
     
    int main()
    {
        int n, a = 0, b = 0, flag = 0;
        vector<int> nums;

        cin >> n;
        
        for(int i = 0; i < n; i++)
        {
            int x;
            cin >> x;
            nums.push_back(x);
        }

        sort(nums.begin(),nums.end());

        for(int i = n-1; i >= 0; i--)
        {   
            if(flag == 0)
            {
                a = a + nums[i];
                flag = 1;
            }

            else
            {
                b = b + nums[i];
                flag = 0;
            }
            
        }

        cout << abs(a-b);

    } 

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
int D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	
	if(N<3) return _P("0\n");
	ll ret=0;
	N-=2;
	D=(1+2+3+8+9+10+15+16+17)%11;
	
	FOR(x,11) {
		ll num=N/11+(x<(N%11));
		FOR(i,5) {
			if((D+(i+x*7)*9)%11==K) ret+=num;
		}
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n,k;
const LL mod=1e9+7;
LL pm(LL x,LL y){
	LL z=1;
	while(y){
		if(y&1)z=z*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return z;
}
LL A[N];
int main() {
  	ios::sync_with_stdio(false);
  	cin>>n>>k;LL ans=0;
  	LL tot=0;
  	for(int i=k;i>=1;i--){//假设当前的gcd为i
  		//则 每个数 最多能乘以f
  		// 设 t数组为n个数 多×的值
  		//显然 gcd(t1....tn)=1
  		//问题转化为元素值在[1,f]的长度为n且gcd=1的数组的个数
  		LL l=pm(k/i,n);
  		for(int j=2*i;j<=k;j+=i){
  			l-=A[j];
  			l=(l+mod)%mod;
  		}
  		A[i]=l;
  		ans+=A[i]*i%mod;
  		ans%=mod;
  	}
  	cout<<ans<<'\n';
 	return 0;	
}

Measured memory_bytes: 3944
#define _DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define check(s)
#endif

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

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

void solve(ll A, ll B) {
   ll r = A+ B;
   if (r >= 10) {
     cout << "error" << endl;
   }else {
     cout << r << endl;
   }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  ll A;
  scanf("%lld", &A);
  ll B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


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

int main() {
	int bn, len, ans = 0;
	vector<int> nums;
	cin >> len;
	for (int i = 0; i < len; i++) {
		cin >> bn;
		nums.emplace_back(bn);
	}
	sort(nums.begin(), nums.end());
	cout << nums[len / 2] - nums[len / 2 - 1];
}

Measured memory_bytes: 892
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		A_IrreversibleOperation solver = new A_IrreversibleOperation();
		solver.solve(1, in, out);
		out.close();
	}

	static class A_IrreversibleOperation {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			char[] s = in.next().toCharArray();
			int nb = 0;
			long ans = 0;
			for (char c : s) {
				if (c == 'B') {
					++nb;
				} else {
					ans += nb;
				}
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

	}
}



Measured memory_bytes: 25192
#include <stdio.h>
#include <string.h>

int main(){
	int N=0;
	int a[100000]={};
	int t=0,f=0,n=0;

	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
		if((a[i]%4)==0)f++;
		else if((a[i]%2)==0)t++;
		else n++;
	}

	if((N<=f*2+t) || (N==f*2+1))printf("Yes");
	else printf("No");


	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,l; cin >> n >> l;
    vector <string> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin() , v.end());
    for (auto it : v)
        cout << it;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[][] s = new String[h][w];
		String ans = "Yes";

		for (int i = 0; i < h; i++) {
			String line = sc.next();
			for (int j = 0; j < w; j++) {
				s[i][j] = line.substring(j, j + 1);
			}
		}
		
		loop1:
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				// System.out.println(s[i][j]);
				if (s[i][j].equals("#")) {
				int sum = 0;
				// 上を数える
				if (i > 0) {
					if (s[i - 1][j].equals("#")) {
						sum++;
					}
				}
				// 下を数える
				if (i < h - 1) {
					if (s[i + 1][j].equals("#")) {
						sum++;
					}
				}
				// 左を数える
					if (j > 0) {
						if (s[i][j - 1].equals("#")) {
							sum++;
						}
					}
				// 右を数える
				if (j < w - 1) {
					if (s[i][j + 1].equals("#")) {
						sum++;
					}
				}
				if (sum == 0) {
					ans = "No";
					break loop1;
				}
				}
			}
		}
		
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileStore;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] order;
      StringBuilder result = new StringBuilder(n*4);
      Dictionary dict = new Dictionary(10_000_000);

      for(int i=0; i<n; i++) {
        order = br.readLine().split(" ");
        switch( order[0] ) {
          case "insert" :
            dict.insert(order[1]);
            break;
          case "find" :
            result.append( dict.find(order[1]) ).append("\n");
            break;
        }
      }

      System.out.print(result);
    }
  }
}

class Dictionary {
  boolean[] dict;

  public Dictionary(int size) {
    dict = new boolean[size];
  }

  public void insert(String str) {
    int key   = getKey(str);
    dict[key] = true;
  }
  public String find(String ref) {
    int key = getKey(ref);

    return isExist(key) ? "yes" : "no";
  }
  private int getKey(String str) {
    int len = str.length();
    int ret = 0;
    StringBuilder buf = new StringBuilder(20);
    for(int i=0,d=10; i<len; i++ ) {
      buf.append( str1ToInt(str.substring(i,i+1)) );
    }
    ret = Integer.parseInt(buf.toString(), 5);

    return ret;
  }
  private boolean isExist(int key) {

    return dict[key];
  }
  private int str1ToInt(String s1) {

    switch( s1 ) {
      case "A" :
        return 1;
      case "C" :
        return 2;
      case "G" :
        return 3;
      case "T" :
        return 4;
      default :
        return -1;
    }

  }
}


Measured memory_bytes: 253232
#include <bits/stdc++.h>
#include <functional>
#include <iostream>
#define  pb push_back
#define  xx first
#define  yy second
#define PI acos(-1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define NL printf("\n")
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;


int main()
{
      //fast;
     int t=1;
     string s;


    while(t--)
    {
         int x,y;
         cin >> x >> y;
         int yes = 0;

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

             for(int j = 0; j<=100; j++){
                if(i*2+j*4==y && i+j==x)
                    yes= 1;
             }
         }

         if(yes){
            cout << "Yes" << endl;
         }
         else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
ans = 0
for i in range(N):
    remain_power = B[i] - A[i]
    if remain_power <= 0:
        ans += B[i]
    else:
        ans += A[i]
        next_A = max(0, A[i+1] - remain_power)
        ans += A[i+1] - next_A
        A[i+1] = next_A
print(ans)

Measured memory_bytes: 81892
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int m,f,r,sum=0;
    char s;
    
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        sum = m+f;
        if(m==-1 && f==-1 && r==-1){
            break;
        }
        
        if(sum>=80){
            s = 'A';
        }
        if(65<=sum && sum<80){
            s = 'B';
        }
        if(50<=sum && sum<65){
            s = 'C';
        }
        if (30<=sum && sum<50){
            if(r>=50){
                s = 'C';
            }else{
                s = 'D';
            }
        }
        if (sum<30){
            s='F';
        }
        if(m==-1 || f==-1){
            s='F';
        }
        printf("%c\n",s);
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  if (s == "Sunny") cout << "Cloudy" << endl;
  else if (s == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w  = sc.nextInt();
        int n = sc.nextInt();

        int c = 0;
        while (n > 0) {
            n -= Math.max(h, w);
            c++;
        }
        System.out.println(c);
    }

}


Measured memory_bytes: 22996
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;
real[] r1 = [ 70,55,50,43,40,37.5,35.5];
real[] r2 = [ 148,116,105,89,83,77,71];
string[] ans = ["NA","E","D","C","B","A","AA","AAA"];

void main(){

    while(true){
	string ss = readln();
	if(stdin.eof()) break;
	auto s = ss.split().to!(real[]);
	for(int i=6;i>=0;i--){
	    if(s[0] < r1[i] && s[1] < r2[i]){
		writeln(ans[i+1]);
		break;
	    }
	    if(i == 0)
		writeln(ans[0]);
	}
    }

}

Measured memory_bytes: 2424
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

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

    map<int, int>mp;
    rep(i,n){
        int ai;
        cin >>ai;
        mp[ai]++;
    }
    ll l=0;
    bool is_ok=true;
    if(n%2==0){    
        while(l*2!=n) l++;
        for(ll i=1; i<=l; i++){
            if(mp[2*i-1]!=2){
                is_ok=false;
                break;
            }
        }
    

    }else{
        while(l*2!=n-1)l++;
        if(mp[0]!=1) is_ok=false;
        for(ll i=1; i<=l; i++){
            if(mp[2*i]!=2){
                is_ok=false;
                break;
            }
            // cout << "is_ok is " << is_ok << endl;
        }
        
    }
    if(is_ok==false){
        cout << 0 << endl;
    }
    else{
        ll ans=1LL;
        // cout << "l is" << l << endl;
        rep(i,l)ans = ((ans%MOD) * 2LL)%MOD;
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  char X, Y; std::cin >> X >> Y;

  if ( X == Y ) std::cout << "=" << std::endl;
  else if ( X < Y ) std::cout << "<" << std::endl;
  else std::cout << ">" << std::endl;

  return 0;
}


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

int main(){
    int64_t a, b, k;
    cin >> a >> b >> k;
    int i;
    if(a >= k){
        a -= k;
    }
    else if((k-a) <= b){
        b = b - k + a;
        a = 0;
    }
    else if(k > a + b){
        a = 0;
        b = 0;
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	vector<int> v;
	string s="";
	while(n)
	{
		n--;
		s+=(n%26+'a');
		n/=26;
	}
	reverse(s.begin(),s.end());
	cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();

        long ans = 0;


        if( K > 2 * N){
            ans = 0;
        }
        else if (K > N){
            if(K % 2 == 0){
                ans = 1;
            }
            else{
                ans = 0;
            }
        }
        else if(K % 2 == 0){
            int KK = 2 * N/K;
            ans += (long) Math.pow((KK/2), 3) + (long) Math.pow( ( ( KK + 1 ) / 2 ), 3);
        }
        else if(K % 2 == 1){
            ans += (long) Math.pow( (N/K) , 3);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include<iostream>
using namespace std;
int A,B,cunt,num;
int main(){
    cin>>A>>B;
    for(num=A;num<=B;num++){
        int reverse = 0;
        int remaind;
        int tmp;

        tmp = num;
        while(tmp!=0)
        {   
            remaind = tmp % 10; 
            reverse = reverse * 10 + remaind;
            tmp /= 10; 
        }   
        /* 反転した数値と元の数値を比較 */
        if( reverse == num )
            cunt++;
    }                                                               

   
    cout<<cunt;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
  int i=0,count=0;
  char S[200010]="",T[200010]="";
  scanf("%s",S);
  scanf("%s",T);
  while(S[i] != '\0'){
    if(S[i] != T[i]) count++;
    i++;
  }
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
# define ll long long
# define mo 1000000009
# define maxi 100005
using namespace std;
int main()
{
    int a,b,ans1,ans2;
    cin>>a>>b;
    int x,y,i;
    int p,q,ans;
    x=(100*a)/8;
    y=(100*b)/10;
    int ma=max(x,y);int mi=min(x,y);
    for(i=1;i<=maxi;i++)
    {
    	p=(i*8)/100;
    	q=(i*10)/100;
    	if(p==a&&q==b){
    		ans=i;
    		break;
		}
	}
	if(i!=maxi+1)
	cout<<ans;
	else
	cout<<"-1";
	return 0;
}

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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i++){
        cin >> S[i];
    } 
    vector<ll> up(N, 0), bottom(N, 0);
    ll up_total = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < S[i].length(); j++){
            if(S[i][j] == '(') up[i]++;
            else{
                up[i]--;
                bottom[i] = min(bottom[i], up[i]);
            }
        }
        if(up[i] < 0) bottom[i] -= up[i];
        up_total += up[i];
    }
    if(up_total != 0){
        cout << "No" << endl;
        return 0;
    }

    vector<pair<ll, ll>> a, u, m, d;
    a.reserve(N);
    u.reserve(N);
    m.reserve(N);
    d.reserve(N);
    for(int i = 0; i < N; i++) a.push_back(make_pair(up[i], bottom[i]));
    for(int i = 0; i < N; i++){
        if(a[i].first > 0) u.push_back(make_pair(a[i].second, a[i].first));
        else if(a[i].first == 0) m.push_back(make_pair(a[i].second, a[i].first));
        else d.push_back(make_pair(a[i].second, a[i].first));
    }
    sort(u.rbegin(), u.rend());
    sort(d.begin(), d.end());

    ll pos = 0;
    for(auto itr = u.begin(); itr != u.end(); itr++){
        if(itr -> first + pos < 0){
            cout << "No" << endl;
            return 0;
        }
        pos += itr -> second;
    }
    for(auto itr = m.begin(); itr != m.end(); itr++){
        if(itr -> first + pos < 0){
            cout << "No" << endl;
            return 0;
        }
        pos += itr -> second;
    }
    for(auto itr = d.begin(); itr != d.end(); itr++){
        pos += itr -> second;
        if(itr -> first + pos < 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    double res = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i != j) {
                double d = hypot(A[i] - A[j], B[i] - B[j]);
                res += d;
            }
        }
    }
    cout << fixed << setprecision(15) << res / N << endl;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if ( a == 1 ) a = 15;
  if ( b == 1 ) b = 15;
  
  if ( a > b ) cout << "Alice" << endl;
  else if ( b > a ) cout << "Bob" << endl;
  else cout << "Draw" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    map<char, int> cnt;

    rep(i, 0, N) {
        if (cnt.count(S[i])) {
            cnt[S[i]]++;
        }
        else {
            cnt[S[i]] = 2;
        }
    }

    ll ans = 1;
    for(auto it = cnt.begin(); it != cnt.end(); ++it) {
        ans *= it->second;
        ans %= 1000000007;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
char str[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>str;
	if(str[0]==str[1]&&str[1]==str[2]) cout<<"No"<<'\n';
	else cout<<"Yes"<<'\n';
    return 0;
}


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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  string S; cin >> S;
  int ans = 0;
  REP(i, S.size()) {
    if(S[i] == '1') ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

ll mod = 1e9 + 7;


int n;
char s[100005];
ll dp[100005][13];

int main(){
	ll res = 0;

	cin >> s;
	n = strlen(s);

	dp[0][0] = 1;
	for(int i=0;i<n;i++){
		int c;
		if(s[i]=='?') c = -1;
		else c = s[i]-'0';

		for(int j=0;j<10;j++){
			if(c!=-1 && c!=j) continue;
			for(int ki=0; ki<13;ki++){
				dp[i+1][(ki*10+j)%13] += dp[i][ki];
			}
		}
		for(int j=0;j<13;j++) dp[i+1][j] %= mod;
	}

	res = dp[n][5];

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 10496
#include <stdio.h>
int main()
{
  int N,i,j,k,flag=1,count=0;
  int A[100];
  
  scanf("%d",&N);

  for(i=0; i<N; i++){
    scanf("%d",&A[i]);
  }

  i = 0;

  while(flag){
    flag = 0;
    for(j=N-1; j>=i+1; j--){
      if(A[j] < A[j-1]){
	k = A[j];
	A[j] = A[j-1];
	A[j-1] = k;
	flag = 1;
	count++;
      }
    }
    i++;
  }

  for(i=0; i<N-1; i++){
    printf("%d ",A[i]);
  }
     printf("%d",A[N-1]);
  
    printf("\n");  
    printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2068
use std::io::stdin;
use std::io::Error;
use std::io::ErrorKind;
use std::io::Read;

#[derive(Debug)]
struct Input {
    n: usize,
    h: Vec<u8>,
}

fn handle_input(input_str: String) -> Result<Input, Error> {
    let mut iter = input_str.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut a = Vec::new();
    for _ in 0..n {
        let v: u8 = iter.next().unwrap().parse().unwrap();
        a.push(v)
    }
    let input = Input { n: n, h: a };
    Ok(input)
}

fn handle_output(input: Input) -> Result<String, Error> {
    let mut hmax = 0;
    let mut count = 0;
    for h in input.h {
        if hmax <= h {
            count += 1;
            hmax = h;
        }
    }
    Ok(format!("{}", count))
}

fn main() {
    let mut input_str = String::new();
    let stdin = stdin();
    stdin.lock().read_to_string(&mut input_str).unwrap();
    let input = handle_input(input_str).unwrap();
    let output = handle_output(input).unwrap();
    println!("{}", output);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int getMinimumCost(int *arr,int i,int n,int k)
{
int cost[n];
cost[0]=0;
cost[1]=abs(arr[0]-arr[1])+cost[0];
int minimum;
for(int i=2;i<n;i++)
{
  minimum=abs(arr[i-1]-arr[i])+cost[i-1];
  for(int j=i-2; j!=-1 && j>=i-k; j--)
  {
    if(minimum>abs(arr[j]-arr[i])+cost[j])
    {
     minimum=abs(arr[j]-arr[i])+cost[j];
    }
  }
  cost[i]=minimum;
  }
return cost[n-1];
}
int main()
{
int n,k;
cin>>n;
cin>>k;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<getMinimumCost(arr,0,n,k)<<endl;
return 0;
}


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

#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n" 
#define all(c) c.begin(),c.end()
#define present(c,element) (c.find(element)!=c.end())
#define cpresent(c,element) (find(c,element)!=c.end())
typedef vector<int> vi;
typedef vector<ll> vll;
ll mod=1e9+7;


int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int test=1;
//cin>>test;
while(test--)
{

	int n,m;
	cin>>n>>m;
	ll h[n];

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

	vector<set<int> > v(n);
	int a,b;
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		a--;b--;
		v[a].insert(b);
		v[b].insert(a);
	}

	int cnt=0;
	for(int i=0;i<n;i++)
	{
		bool f=true;
		for(set<int>::iterator j=v[i].begin();j!=v[i].end();j++)
		{
			if(h[i]<=h[*j])
			{
				f=false;
				break;
			}
		}
		if(f)cnt++;
	}


	cout<<cnt<<endl;
}
return 0;
}









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

//template<class T, size_t N> 
//size_t countof(const T (&array)[N]) { return N; }


int main() {
  string s;
  int K;

  cin >> s;
  cin >> K;

  string strong[K];
  string weak;

  for(int k=0; k<s.size(); k++){
    weak.push_back('z');
  }

  for(int k=0; k<K; k++){
    strong[k] = weak;
  }
  for(int i=0; i < s.size(); i++){
    string tmp="";
    for(int j=0; i+j < s.size(); j++){
      tmp.push_back(s[i+j]);
      //      cout <<i<<" "<< tmp << endl;
      int flag=0;
      for(int k=0; k<K; k++){
	if(strong[k] == tmp) flag=1;
      }
      if(flag==1) continue;
      //比較代入
      for(int k=0; k<K; k++){
	if(strong[k] > tmp){
	  //	  cout << strong[k] << ">" << tmp <<endl;
	  for(int l=K-1; l > k; l--){
	    strong[l] = strong[l-1];
	  }
	  strong[k] = tmp;
	  break;
	}
      }
    }
  }

  cout << strong[K-1] << endl;


}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0184

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break
        visitors = defaultdict(int)

        for _ in range(n):
            age = int(input())
            if age < 10:
                visitors['under10'] += 1
            elif age < 20:
                visitors['10s'] += 1
            elif age < 30:
                visitors['20s'] += 1
            elif age < 40:
                visitors['30s'] += 1
            elif age < 50:
                visitors['40s'] += 1
            elif age < 60:
                visitors['50s'] += 1
            else:
                visitors['60s+'] += 1

        print(visitors['under10'])
        print(visitors['10s'])
        print(visitors['20s'])
        print(visitors['30s'])
        print(visitors['40s'])
        print(visitors['50s'])
        print(visitors['60s+'])



def main2(args):
    while True:
        n = int(input())
        if n == 0:
            break
        age = [0] * (120 + 1)

        for _ in range(n):
            n = int(input())
            age[n] += 1

        print(sum(age[0:10]))
        print(sum(age[10:20]))
        print(sum(age[20:30]))
        print(sum(age[30:40]))
        print(sum(age[40:50]))
        print(sum(age[50:60]))
        print(sum(age[60:]))


if __name__ == '__main__':
    main2(sys.argv[1:])

Measured memory_bytes: 7992
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,m,c,s,g,e[21][101][101],un[21][20001];

int solve(){
  int used[101]={};
  priority_queue<P,vector<P>,greater<P> > Q;
  Q.push(P(0,s));
  while(!Q.empty()){
    int ct=Q.top().first,pos=Q.top().second;Q.pop();
    if(used[pos]++)continue;
    if(pos==g)return ct;
    for(int i=1;i<=c;i++)
      for(int j=1;j<=n;j++)
	if(e[i][pos][j]!=1e9)Q.push(P(ct+un[i][e[i][pos][j]],j));
  }
  return -1;
}

int main(){
  while(cin>>n>>m>>c>>s>>g,n){
    for(int i=1;i<=c;i++)
      for(int j=1;j<=n;j++)
	for(int k=1;k<=n;k++)e[i][j][k]=1e9;
    for(int i=0,x,y,d,k;i<m;i++){
      cin>>x>>y>>d>>k;
      e[k][x][y]=e[k][y][x]=min(e[k][x][y],d);
    }
    for(int i=1;i<=c;i++)
      for(int j=1;j<=n;j++)
	for(int k=1;k<=n;k++)
	  for(int l=1;l<=n;l++)
	    e[i][k][l]=min(e[i][k][j]+e[i][j][l],e[i][k][l]);
    int p[101];
    for(int i=1;i<=c;i++)cin>>p[i];
    for(int i=1;i<=c;i++){
      int q[50],r[50];
      q[p[i]-1]=1e9;
      for(int j=0;j<p[i]-1;j++)cin>>q[j];
      for(int j=0;j<p[i];j++)cin>>r[j];
      int nw=0;
      for(int j=0;j<20000;j++){
	if(q[nw]<=j)nw++;
	un[i][j+1]=un[i][j]+r[nw];
      }
    }
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 7284
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#include<ctype.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
void U();
void D();
char name[128],t[128];
int main(){
	char type;
	while (~fscanf(stdin, "%s %c%\n", name, &type),type!='X') {
		memset(t, 0, sizeof(t));
		switch (type){
		case 'L':
			U();
			t[0] = tolower(t[0]);
			break;
		case 'U':
			U();
			t[0] = toupper(t[0]);
			break;
		case 'D':
			D();
		}
		P(s, t);
	}
	return 0;
}

void U(){
	int i, j;
	for(i=j=0;name[i];i++)
		if (name[i] == '_') name[i + 1] -= 0x20;
		else t[j++] = name[i];
}

void D(){
	int i, j;
	for (i = j = 0; name[i]; i++)
		if (i&&name[i] != '_'&&name[i]<'a') t[j++] = '_', t[j++] = tolower(name[i]);
		else t[j++] = tolower(name[i]);
}

Measured memory_bytes: 548
#include <stdio.h>

int a[4];

int main(){
	scanf("%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4]);
	for(int i=0; i<=4; i++){
		if(a[i]==0) printf("%d", i+1);
	}
	return 0;
}

Measured memory_bytes: 1724
#include <stdio.h>

int main(void)
{
    int a, b, d, r;
    double f;
    char buf[256];
    fgets(buf, 256, stdin);
    sscanf(buf, "%d %d", &a, &b);
    d = a / b;
    r = a % b;
    f = (.0 + a) / b;
    printf("%d %d %.5lf\n", d, r, f);
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5+5 , M = 1e9+7, OO = 0x3f3f3f3f;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const double Pii = 3.14159265359;
ll n, x, k;
ll a[N], b[N];

int main()
{
    FIO
    vector<ll> pos, neg;
    bool z=0;
    cin >> n >> k;
    for(int i=0; i<n; ++i)
    {
        cin >> x;
        if(x > 0) pos.push_back(x);
        else if(x < 0) neg.push_back(-x);
        else z=1;
    }

    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    int psz = pos.size(), nsz = neg.size();
    ll ans = 1;
    ll tk = 0;
    bool ok = 1;

    if(psz+((nsz/2)*2) >= k && !(psz == 0 && k%2 == 1))
    {
        int p1 = psz-1, p2 = nsz-1;
        if(k%2 == 1)
        {
            ans*=pos[p1--];
            ans%=M;
            tk++;
        }
        while(tk < k)
        {
            if(p2 > 0 && p1 > 0)
            {
                if(pos[p1]*pos[p1-1] > neg[p2]*neg[p2-1])
                {
                    ans*=pos[p1--];
                    ans%=M;
                    ans*=pos[p1--];
                    ans%=M;
                    tk+=2;
                }
                else
                {
                    ans*=neg[p2--];
                    ans%=M;
                    ans*=neg[p2--];
                    ans%=M;
                    tk+=2;
                }
            }
            else if(p1 > 0)
            {
                ans*=pos[p1--];
                ans%=M;
                ans*=pos[p1--];
                ans%=M;
                tk+=2;
            }
            else
            {
                ans*=neg[p2--];
                ans%=M;
                ans*=neg[p2--];
                ans%=M;
                tk+=2;
            }
        }
    }
    else if(z) ans = 0;
    else
    {
        int p1 = 0, p2 = 0;
        while(tk < k)
        {
            if(p1 < psz && p2 < nsz)
            {
                if(pos[p1] < -neg[p2])
                {
                    ans*=pos[p1++];
                    ans %= M;
                }
                else
                {
                    ans*= neg[p2++];
                    ans %= M;
                }
            }
            else if(p1 < psz)
            {
                ans*=pos[p1++];
                ans %= M;
            }
            else
            {
                ans*= neg[p2++];
                ans %= M;
            }
            tk++;
        }
        ok = 0;
    }
    if(ok) cout << ans << endl;
    else cout << ((M-ans)+M)%M << endl;
    return 0;
}


Measured memory_bytes: 5516
time = 0
m = 10
for i in range(5):
    i2 = input()
    if m > int(i2[-1]) and int(i2[-1]) != 0:
        m = int(i2[-1])
    time += ((int(int(i2) / 10) + 1) * 10) if int(i2) % 10 != 0 else int(i2) 
time = time - 10 + m
print(time)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int a,b,i,j=0,k,d[100]={};
  scanf("%d%d%d",&a,&b,&k);
  for(i=1;i<=100;i++){
    if(a%i==0&&b%i==0){
      j++;
      d[j]=i;
    }
  }
  printf("%d",d[j-k+1]);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	int A_max = F / (100 * A);
	int B_max = F / (100 * B);
	set<int>water;
	water.insert(0);
	for (int i = 0; i <= A_max; i++)for (int j = 0; j <= B_max; j++) {
		if (100 * A*i + 100 * B*j <= F)water.insert(100 * A*i + B*j * 100);
	}

	set<double>sugar;
	sugar.insert(0);
	int C_max = F / (C);
	int D_max = F / (D);
	for (int i = 0; i <= C_max; i++)for (int j = 0; j <= C_max; j++) {
		if (C*i + D*j <= F)sugar.insert(C*i + D*j);
	}
	pair<int, int>ans;
	ans.first = 100 * A;
	ans.second = 0;
	double t = 0;
	for (auto &g : water) {
		double x = min(g / 100 * E, F - g);
		auto y = prev(upper_bound(all(sugar), x));

		double tmp = 100.0**y / (g + *y);

		if (g + *y <= F&&tmp > t&&tmp <= 100) {
			t = tmp;
			ans.first = g;
			ans.second = *y;
		}
	}
	dump(A_max, B_max, C_max, D_max);
	dump(sugar);
	dump(water);
	dump(t);
	cout << ans.first + ans.second << " " << ans.second << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll = long long;
int main() {
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<a){
    cout<<k<<endl;
    return 0;
  }
  else if(k<=a+b){
    cout<<a<<endl;
    return 0;
  }
  else{
    cout<<a-(k-a-b)<<endl;
  }
    
  
}


Measured memory_bytes: 3636
n = int(input())
alist = list(map(int, input().split()))
o, e = 0, 0

for a in alist:
  if a % 2 == 0:
    e += 1
  else:
    o += 1

if o % 2 == 1:
  print('NO')
else:
  print('YES')

Measured memory_bytes: 14112
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

int main(){
	int n, r, l, d, t, x, u = 0;
	scanf("%d%d%d", &n, &r, &l);
	int m = 1;
	while(m < n){
		m <<= 1;
	}
	vector<int> s(n), c(n), p(2 * m - 1, n - 1);
	for(int i = n - 1; i >= 0; --i){
		p[i + m - 1] = i;
	}
	for(int i = m - 2; i >= 0; --i){
		p[i] = p[i * 2 + 1];
	}
	for(int i = 0; i < r; ++i){
		scanf("%d%d%d", &d, &t, &x);
		c[p[0]] += t - u;
		u = t;
		s[d - 1] += x;
		d += m - 2;
		while(d > 0){
			d = (d - 1) >> 1;
			p[d] = p[2 * d + (s[p[2 * d + 1]] >= s[p[2 * d + 2]] ? 1 : 2)];
		}
	}
	c[p[0]] += l - u;

	int ans = max_element(c.begin(), c.end()) - c.begin() + 1;
	printf("%d\n", ans);
}

Measured memory_bytes: 2588
const processData = (lines) => {
    const S = lines[0]
    const T = lines[1]
    let min = T.length
    for (let i=0; i<S.length-T.length+1; i++) {
        let changes = T.length;
        for (let j=0; j<T.length; j++) {
            if (S[i+j] === T[j]) {
                changes--
            }
        }
        min = Math.min(min, changes)
    }

    console.log(min)
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    processData(lines)
})


Measured memory_bytes: 32984
import java.util.Scanner;

public class Main {
// Mainに書き換え！

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        while (true){
            boolean t = false;
            for (int i = 0; i < n; i++) {
                if(a[i] % 2 != 0) t = true;
            }
            if (t) break;
            for (int i = 0; i < n; i++) {
                a[i] /= 2;
            }
            ++ans;
        }
        // 出力
        System.out.println(Integer.toString(ans));
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n 
#define pl(n) cout<<n<<" "
const int Nx=1e5;
const int inf=(int)(1e19+10LL);
void solve()
{
  int A,B,N;
  sl(A);sl(B);sl(N);
  int ans=min(B-1,N);
  int val1=(A*ans)/B;
  int val2=A*((ans)/B);
  cout<<(val1-val2)<<endl;
  
}

signed main(){
  int test=1;
// sl(test);
 while(test--){
 	solve();
 }
 
}

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

using namespace std;

const int N = 30;
int p[N];

int main(){
    int n;

    scanf("%d", &n);

    for(int i = 0 ; i < n ; i++){
        scanf("%d", &p[i]);
    }

    int cnt = 0;

    for(int i = 1 ; i < n - 1 ; i++){
        int mn = min(p[i - 1], p[i + 1]);
        int mx = max(p[i + 1], p[i - 1]);

        if(p[i] > mn && p[i] < mx){
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}

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

int main()
{
    int N;
    long long ans = 0;
    cin >> N;
    long long before = 0, now = 0;
    cin >> before;
    if (before != 0){
        cout << -1 << endl;
        return 0;
    }
    for (int i = 1; i < N; i++)
    {
        cin >> now;
        if (before + 1 < now){
            cout << -1 << endl;
            return 0;
        }
        if (before + 1 == now){
            ans++;
        }
        else
        {
            ans += now;
        }
        before = now;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)


i, j, k = x, y, 0

def check(z , l):
    return z > l[-1]

while i**2 + j**2 > 0 and k < len(r):
    if i*j != 0:
        if r[k] > p[i-1] or r[k] > q[j-1]:
            if p[i-1] > q[j-1]:
                j -= 1
            else:
                i -= 1
        else:
            break
    elif i > 0:
        if r[k] > p[i-1]:
            i -= 1
        else:
            break

    elif j > 0:
        if r[k] > q[j-1]:
            j -= 1
        else:
            break


    k += 1

print(sum(p[:i])+sum(q[:j])+sum(r[:k]))

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

int main()
{
	long long n, a, b; cin >> n >> a >> b;

	long long ans = 0;
	long long sum = a + b;
	long long mo;

	ans += n / sum * a;
	ans += min(a, n % sum);
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
As = list(map(int, input().split()))

total = 0
for i in range(n):
    total += As[i]

# detect optimal number
ave = total / n

if ave != int(ave):
    if ave >= int(ave)+0.5:
        ave = int(ave)+1
    else:
        ave = int(ave)

ans = 0
for i in range(n):
    ans += (ave-As[i])**2

print(int(ans))

Measured memory_bytes: 3064
N, Y = map(int, input().split())
flag = 0

for x in range(N+1):
    for y in range(N-x+1):
        z = N-x-y
        if z >= 0 and Y == (x*10000 + y*5000 + z*1000):
            flag = 1
            break
    
    if flag == 1:
        break

if flag == 1:
    print(x,y,z)
else:
    print("-1 -1 -1")

Measured memory_bytes: 3060
N = int(input())
n_list = []
count = 1
max_val = 1
res = 0
for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            res = x**2 +y**2 + z**2 + x*y + y*z + z*x
            for i in range(int(x!=y) + int(y!=z) + int(z!=x)-1):
                count *= 3-i
            if max_val < res:
                for i in range(max_val, res+1):
                    if i != res: n_list.append(0)
                    else: n_list.append(count)
                max_val = res+1
            else:
                n_list[res-1] += count
            count = 1

            

for i in range(N):
    print(n_list[i])


Measured memory_bytes: 9596
#include<bits/stdc++.h>
using namespace std;
const int N=100000;
int a[N+1];
int dp[N+1];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	dp[2]=abs(a[2]-a[1]);
	for(int i=3;i<=n;i++)dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout<<dp[n];
	return 0;
}

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

using namespace std;

int main(){
    int n,q;
    cin>>n>>q;
    vector<pair<int,pair<int,int>>> d(n);
    vector<int> p(q);
    for (int i = 0; i < n; ++i) {
        int a,b,c;
        cin>>a>>b>>c;
        d[i]=make_pair(c,make_pair(a,b));
    }
    sort(d.begin(),d.end());
    for (int i = 0; i < q; ++i) {
        cin>>p[i];
    }

    vector<int> ans(q,-1);
    int safel=-1;
    int safer=q;
    for (int i = 0; i < n; ++i) {
        if(safel>=q-1)break;
        if(safer<=0)break;
        int okl=safel;
        int ngl=q;
        int midl=(okl+ngl)/2;
        while((ngl-okl)!=1){
            midl=(okl+ngl)/2;
            if(p[midl]+d[i].first<d[i].second.first)okl=midl;
            else ngl=midl;
        }

        int okr=safer;
        int ngr=-1;
        int midr=(okr+ngr)/2;
        while((okr-ngr)!=1){
            midr=(okr+ngr)/2;
            if(p[midr]+d[i].first>=d[i].second.second)okr=midr;
            else ngr=midr;
        }

        for (int j = ngl; j <= ngr; ++j) {
            if(ans[j]==-1)ans[j]=d[i].first;
        }
        while(1){
            if(safel>=q)break;
            if(ans[safel+1]!=-1)++safel;
            else break;
        }
        while(1){
            if(safer<=0)break;
            if(ans[safer-1]!=-1)--safer;
            else break;
        }
    }
    for(auto i:ans)cout<<i<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

int n, q;
string s;
char t[200010], d[200010];

int check(int cur){
    if(s[cur] == '#') return cur;
    rep(i, q)if(s[cur] == t[i]){
        if(d[i] == 'L') --cur;
        else ++cur;
        if(s[cur] == '#') return cur;
    }
    return cur;
}

int main(){
    scanf("%d%d", &n, &q);
    cin >> s;
    s = "#" + s + "#";
    rep(i, q) scanf(" %c %c", &t[i], &d[i]);
    if(check(0) == n+1 || check(n-1) == 0){
        printf("0\n");
        return 0;
    }
    int high = n+1;
    int low = 0;
    while(high - low > 1){
        int mid = (high + low) / 2;
        if(check(mid) == 0) low = mid;
        else high = mid;
    }
    int l = high;
    high = n+1;
    low = 0;
    while(high - low > 1){
        int mid = (high + low) / 2;
        if(check(mid) == n+1) high = mid;
        else low = mid;
    }
    int r = high;
    printf("%d\n", r - l);
}

Measured memory_bytes: 992
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
s=list(input())

for i in range(len(s)):
    ss=chr((ord(s[i])+n-ord('A'))%26+ord('A'))
    s[i]=ss
print("".join(s))

Measured memory_bytes: 71368
'use strict';

function main(input) {
  const args = input.split('\n'),
        K = parseInt(args[0].split(' ')[1]),
        H = args[1].split(' ');
  var ans = H.sort((a, b) => b-a).slice(K).reduce((a, x) => a + parseInt(x), 0);
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

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

  rep(i, n - k) cout << (a[i] < a[i + k] ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 4048
using System;

public class DebtHell
{
	public static void Main(string[] args)
	{
		int week = int.Parse(Console.ReadLine());
		uint cache = 100000;
		for (int i = 0; i < week; i++)
		{
			cache = (uint)Math.Ceiling(cache * 1.05 / 1000) * 1000;
		}
		Console.WriteLine(cache);
	}
}

Measured memory_bytes: 5624
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long[] dp = new long[301];
		Arrays.fill(dp, 1);
		for (int i = 2; i <= 17; ++i) {
			for (int j = 300; j >= i * i; --j) {
				for (int k = 1; j - k * i * i >= 0; ++k) {
					dp[j] += dp[j - k * i * i];
				}
			}
		}
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			System.out.println(dp[N]);
		}
	}
}

Measured memory_bytes: 12000