akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

int main()
{
    double x1, y1, x2, y2, a, b;
    
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    a = x2 - x1;
    b = y2 - y1;
    printf("%f\n", sqrt(a*a+b*b));
    return 0;
}



Measured memory_bytes: 2732
import java.util.*;
import java.io.PrintWriter;
public class Main {
	
	static PrintWriter out;
	static Scanner sc;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc=new Scanner(System.in);
		out=new PrintWriter(System.out);
		
		int m=sc.nextInt();
		long k=7,ans=1;
		HashSet<Long> hs=new HashSet<>();
		hs.add(k);
		int flag=0;
		while(true) {
			if(k%m==0) {
				out.print(ans);
				break;
			}
			else {
				ans+=1;
				k*=10;
				k+=7;
				k%=m;
				if(hs.contains(k)) {
					flag=1;
					break;
				}
				else {
					hs.add(k);
				}
			}
		}
		
		if(flag==1) {
			out.print(-1);
		}
		sc.close();
		out.close();
		
	}
}


Measured memory_bytes: 132232
/* ex 7_1
series2 */
#include <stdio.h>

typedef struct point {
    int x_elem;
    int y_elem;
} point;

point shift_point(point p, point shift) {
    point result;
    result.x_elem = p.x_elem + shift.x_elem;
    result.y_elem = p.y_elem + shift.y_elem;
    return result;
}

int main(void) {
    // input and set variable
    point first;
    point second;
    point shift;
    point third;
    point fourth;
    scanf("%d", &(first.x_elem));
    scanf("%d", &(first.y_elem));
    scanf("%d", &(second.x_elem));
    scanf("%d", &(second.y_elem));

    // calculate vector
    shift.x_elem = first.y_elem - second.y_elem;
    shift.y_elem = second.x_elem - first.x_elem;

    third = shift_point(second, shift);
    fourth = shift_point(first, shift);

    printf("%d %d %d %d\n", third.x_elem, third.y_elem, fourth.x_elem,
           fourth.y_elem);
    return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>

int main(void){

  long n,x,y;
  scanf("%ld %ld %ld", &n, &x, &y);

  long answer_list[n];
  for (long i = 0; i < n; i++) {
    answer_list[i] = 0;
  }
  long length;
  long case1,case2;
  long a,b,tmp;
  for (long i = 1; i < n; i++) {
    for (long j = i+1; j <= n; j++) {
      case1 = j-i;
      case2 = 1;
      a = i-x;
      if (a < 0) {
        a = -a;
      }
      b = i-y;
      if (b < 0) {
        b = -b;
      }
      if (a < b) {
        case2 += a;
        tmp = j-y;
        if (tmp < 0) {
          tmp = -tmp;
        }
        case2 += tmp;
      } else {
        case2 += b;
        tmp = j-x;
        if (tmp < 0) {
          tmp = -tmp;
        }
        case2 += tmp;
      }
      length = case1;
      if (case2 < length) {
        length = case2;
      }
      answer_list[length]++;
    }
  }

  for (long i = 1; i < n; i++) {
    printf("%ld\n", answer_list[i]);
  }

  return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

ll n, a, b;

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

    cin >> n >> a >> b;
    if (n < a || b - a <= 2) cout << n + 1 << endl;
    else {
        ll x = (n - (a - 1)) / 2;
        cout << 1 + n - x * 2 + (b - a) * x << endl;
    }
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

template <typename T>
class WeightedUnionFind{
private:
  std::vector<int> par;
  std::vector<int> rnk;
  std::vector<T> diff;
public:
  WeightedUnionFind(int n):par(n),rnk(n),diff(n){
    for(int i=0;i<n;i++){
      par[i]=i;
      rnk[i]=0;
      diff[i]=0;
    }
  }

  T weight(int x){
    find(x);
    return diff[x];
  }
  
  int find(int x){
    if(par[x] == x)
      return x;
    else{
      int ret = find(par[x]);
      diff[x] += diff[par[x]];
      par[x]=ret;
      return ret;
    }
  }

  void unite(int x,int y,T w){
    w+=weight(x);w-=weight(y);
    x=find(x);
    y=find(y);
    if(x==y)
      return;
      
    if(rnk[x] < rnk[y]) {swap(x,y);w=-w;}
    par[y] = x;
    if(rnk[x]==rnk[y]) rnk[x]++;
    diff[y]=w;
  }

  bool same(int x,int y){
    return find(x) == find(y);
  }
};


int n,m;

int main(){
  cin>>n>>m;
  WeightedUnionFind<LL> wun(n);
  int l,r;
  LL d;
  REP(i,m){
    cin>>l>>r>>d;l--;r--;
    if(wun.same(l,r)&&d!=(wun.weight(r)-wun.weight(l))) {cout<<"No"<<endl;return 0;}
    wun.unite(l,r,d);
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(x,n) for(int i=x;i<n;i++)
#define REP(y,n) for(int j=y;j<n;j++)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
signed main(){
  double n,count=0;
  double count2=0;
  while (true) {
    cin>>n;
    if(n==0)break;
    vector<double> s(n);
    rep(0,n){
      cin>>s[i];
      count+=s[i];
    }
    double avg=count/n;
    rep(0,n){
      count2+=(s[i]-avg)*(s[i]-avg);
    }
    printf("%.8f\n",sqrt(count2/n));
    count=0;
    count2=0;
  }
}



Measured memory_bytes: 3180
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
	long a,b,c,d,i,j,k,r[1000];
	scanf("%ld",&a);
	b=a;
	r[0]=b%10;
	for(c=1;b>9;c++){
		b/=10;
		r[c]=b%10;
	}
	d=0;
	for(i=0;i<c;i++){
		d+=r[i];
	}
	if(a%d==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0; 
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] s = sc.next().toCharArray();
    int ans = 700;
    for (char c : s) {
      if (c == 'o') {
        ans += 100;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
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
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DChristmas solver = new DChristmas();
        solver.solve(1, in, out);
        out.close();
    }

    static class DChristmas {
        long[] patties;
        long[] layers;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long x = in.nextLong();

            patties = new long[n + 1];
            layers = new long[n + 1];
            patties[0] = 1;
            layers[0] = 1;
            for (int i = 1; i <= n; i++) {
                patties[i] = 2 * patties[i - 1] + 1;
                layers[i] = 2 * layers[i - 1] + 3;
            }

            long answer = solve(x, n);
            out.println(answer);
        }

        long solve(long x, int n) {
            if (x >= layers[n]) {
                return patties[n];
            }

            if (x <= 0) {
                return 0;
            }

            long result = 0;
            x--; // bun
            result += solve(x, n - 1);
            x -= layers[n - 1]; // small burger
            if (x > 0)
                result++; // middle patty
            x--; // middle patty
            result += solve(x, n - 1);

            return result;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 23380
#include <iostream>
#include <cmath>
#include <stack>
using namespace std;

int main(){
	int n,i;
	stack <int> ans;
	while(cin >> n){
		for (i = 9; i >= 0; i--) {
			if(pow(2.0, i) <= n){
				n -= pow(2.0, i);
				ans.push(pow(2.0, i));
			}
		}

		while(!ans.empty()){
			cout << ans.top();
			ans.pop();
			if(!ans.empty()){
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
class Program
{
    static void Main(string[] args)
    {
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);
        // 文字列の入力
        string S = Console.ReadLine();

        string retValue = string.Empty;
        string ret1 = string.Empty;
        string ret2 = string.Empty;
        string ret3 = string.Empty;

        //文字列の加工
        if (K > 1)
        {
            ret1 = S.Substring(0, (K - 1));
            ret2 = S.Substring((K - 1), 1);
            ret3 = S.Substring(K);
        }
        else
        {
            ret2 = S.Substring(0, 1);
            ret3 = S.Substring(1);
        }

        //出力
        Console.WriteLine(ret1 + ret2.ToLower() + ret3);
    }
}

Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;

namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
            string line;
            int rect = 0;
            int loz = 0;
            while ((line = Console.ReadLine()) != null)
            {
                var num = line.Split(',').Select(x => int.Parse(x)).ToArray();
                int a = num[0];
                int b = num[1];
                int c = num[2];

                if (a == b && a * a + b * b != c * c)
                {
                    loz++;
                }
                else if (a != b && a * a + b * b == c * c)
                {
                    rect++;
                }
            }
            Console.WriteLine("{0}\n{1}", rect, loz);
        }
    }
}




Measured memory_bytes: 16416
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,n,d,tmp = 0,cnt,sum = 0,i,j,a,b,c,mx = LLONG_MIN,mn = LLONG_MAX;

    string str,str1;
    map<int,int>mp;
    vector<int>v;
    set<int>s;


        cin>>a>>b>>c>>d;
        i = 0;
        while(a>0 && c>0)
        {
            if(i%2==0)
                c -= b;
            else
                a -= d;
            i++;
        }
        if(a>0)
            cout<<"Yes\n";
        else
            cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3628
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  string S; cin >> S;
  ll ans = 0, B = 0;
  for (int i = 0; i < S.length(); i++){
    if (S[i] == 'W') ans += B;
    else B++;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

typedef long long int ll;

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

  ll n;
  cin >> n;
  vector < ll > r(n + 1);
  for(int i = 1; i <= n; i++){
    ll p;
    cin >> p;
    r[p] = i;
  }

  const ll p = 3e4;
  for(int i = 1; i <= n; i++){
    cout << p * i << " ";
  }
  cout << '\n';
  for(int i = 1; i <= n; i++){
    ll b = p * (n - i) + r[i];
    cout << b << " ";
  }
  cout << '\n';
}


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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	while(1){
		int n, r;
		vector<int> card;
		cin >> n >> r;
		if(n == 0 && r == 0) break;

		for(int i=n; i>=1; i--){
			card.pb(i);
		}
		for(int i=0; i<r; i++){
			int p, c;
			cin >> p >> c;
			vector<int> tmp;

			for(int i=p-1; i< p-1+c; i++){
				tmp.pb(card[i]);
			}
			for(int i=0; i < p-1; i++){
				tmp.pb(card[i]);
			}
			for(int i=p-1+c; i < card.size(); i++){
				tmp.pb(card[i]);
			}

			card = tmp;
		}
		cout << card[0] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>

int main(void) {

int a, b, c;

scanf ("%d %d %d", &a, &b, &c);

if (a < b) {
    if (b < c)
        printf ("Yes\n");
    else
        printf ("No\n");
}
else
    printf ("No\n");

return 0;

}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n;cin >> n;
    string s;cin >> s;
    int count[3] = {0};
    rep(i,n){
        if(s[i]=='R') count[0]++;
        else if(s[i]=='G') count[1]++;
        else count[2]++;
    }
    ll sum = (ll) count[0] * count[1] * count[2];

    for(int left = 0;left<n;++left){
        for(int right =left+2;right<n;right += 2){
            int cen = (left + right) /2;
            if(s[left] != s[cen] && s[left] != s[right] && s[cen] != s[right]){
                --sum;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long MOD = 1_000_000_007;
		long a = 1, b = 1, c = 1;
		for(int i = 0; i < N; i++) {
			a = a * 8 % MOD;
			b = b * 9 % MOD;
			c = c * 10 % MOD;
		}
		System.out.println((c - b * 2 + a + 2 * MOD) % MOD);
	}

}


Measured memory_bytes: 35700
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    string S;
    cin >> S;
    
    string ss = "RGB";
    vvi rgb(N+1,vi(3,0));
    for (int i = N-1; i >= 0; i--) {
        rep(j,3){
            rgb[i][j] = rgb[i+1][j];
            if(ss[j] == S[i]) rgb[i][j]++;
        }
    }
    
    ll ans = 0;
    
    rep(i,N) reps(j,i+1,N){
        if(S[i] == S[j]) continue;
        int sij = j-i;
        
        int a = -1;
        rep(k,3) if(ss[k] != S[i] && ss[k] != S[j]) a = k;
        
        ans += (ll)rgb[j+1][a];
        if(j+sij < N) if(ss[a] == S[j+sij]) ans--;
    }
    
    cout << ans << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
#define LL long long
#define SZ(x) (int)x.size()-1
#define F(i,a,b) for (int i=a;i<=b;++i)
#define DF(i,a,b) for (int i=a;i>=b;--i)
#define pb push_back
#define ms(a,b) memset(a,b,sizeof a)
using namespace std;
int read(){
    char ch=getchar(); int w=1,c=0;
    for (;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
    for (;isdigit(ch);ch=getchar()) c=(c<<3)+(c<<1)+(ch^48);
    return w*c;
}
const int M=110;
int aim[M][M],bl[M];
vector<int> canditate[M][M];
bool used[M];
int n,m,a[M][M],b[M][M],c[M][M];
bool Fd(int x){
	F(i,1,n){
		if (canditate[x][i].size() && !used[i]){
			used[i]=1;
			if (!bl[i] || Fd(bl[i])){
				bl[i]=x;
				return 1;
			}
		}
	}
	return 0;
}
void match(int row){
	int tmp=0;
	ms(bl,0);
	for (int i=1;i<=n;i++){
		ms(used,0);
		if (Fd(i)) tmp++;
	}		
//	cout<<row<<" -------------  "<<tmp<<"\n";
	assert(tmp==n);
	F(i,1,n){
		if (bl[i]){
			int x=canditate[bl[i]][i].back();
			canditate[bl[i]][i].pop_back();
			b[bl[i]][row]=x;
			c[i][row]=x;
		}
	}
}
int main(){
	n=read(); m=read();
	F(i,1,n) F(j,1,m) {
		a[i][j]=read();
		aim[i][j]=(a[i][j]-1)/m+1;
		canditate[i][aim[i][j]].pb(a[i][j]);
	}
	F(i,1,m){
		match(i);
	}
	F(i,1,n) {
		F(j,1,m) cout<<b[i][j]<<" ";
		cout<<"\n";
	}
	F(i,1,n) {
		F(j,1,m) cout<<c[i][j]<<" ";
		cout<<"\n";
	}
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int x,y;
int main(void)
{
    cin>>x>>y;
    if(4*x<y||y<2*x)cout<<"No"<<endl;
    else
    {
        if((4*x-y)%2)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3600
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**9 for i in range(n)]
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(1,k+1):
        if((i-j)>=0):
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
            
print(dp[n-1])

Measured memory_bytes: 83476
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int k,a,b;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> k >> a >> b;
	rep(10000){
		if(k*i>b) break;
		if(k*i>=a&&k*i<=b){
			print1("OK");
			return 0;
		}
	}
	print1("NG");
	return 0;
}

Measured memory_bytes: 3640
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

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

#define fi first
#define se second

using namespace std;

typedef long long ll;

int l, r;

void solve() {                   
	scanf("%d %d", &l, &r);

    if (l <= 0 && 0 <= r) {
    	printf("Zero\n");
    	return;
    }

    if (l > 0) {
    	printf("Positive\n");
    	return;
    }

    if ((r - l + 1) & 1) {
    	printf("Negative\n");
    }                 
    else {
    	printf("Positive\n");
    }
}

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
// finish date: 2019/06/09

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


//足し算
int add(int a, int b) {
    return (int) (((ll) a + b + bigmod) % bigmod);
}

int main() {
    int N, M;
    cin >> N >> M;
    vi a(M);
    vb isbreak(N + 1, false);
    rep(i, M) {
        cin >> a[i];
        isbreak[a[i]] = true;
    }

    vi dp(N + 2, 0);
    dp[0] = 1;
    rep(i, N) {
        if (!isbreak[i + 1]) {
            dp[i + 1] = add(dp[i + 1], dp[i]);
        }
        if (!isbreak[i + 2]) {
            dp[i + 2] = add(dp[i + 2], dp[i]);
        }
    }

    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){  
  int a[5];
  for(int i=0;i<5;i++){
    cin>>a[i];
  }
  sort(a,a+5);
  for(int i=4;i>=0;i--){
    if(i!=0)
    cout<<a[i]<<" ";
    else 
      cout<<a[i];
  }
  cout<<endl;
  return 0;
  
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    map<string,ll> m;
    while(n--)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<(m.find("AC")==m.end()?0:m["AC"])<<"\n";
    cout<<"WA x "<<(m.find("WA")==m.end()?0:m["WA"])<<"\n";
    cout<<"TLE x "<<(m.find("TLE")==m.end()?0:m["TLE"])<<"\n";
    cout<<"RE x "<<(m.find("RE")==m.end()?0:m["RE"])<<"\n";
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;
int main(void) {
  lld a, b, n, m = 0;
  cin >> a >> b >> n;
  if (b > n) {
    cout << ((a * n / b) - a * (n / b)) << "\n";
  } else {
    cout << ((a * (b - 1) / b) - a * ((b - 1) / b)) << "\n";
  }
}


Measured memory_bytes: 3632
N = int(input())

A = list(map(int, input().split()))

rui = [0] * N

rui[0] = A[0]
for it in range(1, N):
    rui[it] = rui[it - 1] + A[it]

ans = 1145141919810
for i in range(0, N - 1):
    ans = min(abs(rui[i] - rui[N - 1] + rui[i]), ans)

print(ans)


Measured memory_bytes: 23792
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		int count = 0;
		for(char v : a.toCharArray()){
			if( v == '2'){
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 22228
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
#include <string>

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl

using namespace std;
using i64 = long long;

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

    if (n % 2 == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    i64 ans = 0LL;

    vector<i64> pow5_list;
    i64 pow5 = 1;
    while (pow5 <= pow(10, 17))
    {
        pow5_list.push_back(pow5);
        pow5 *= 5;
    }

    i64 liln = n / 10LL;
    for (int i = 1; i < pow5_list.size(); i++)
    {
        i64 quot = liln / pow5_list[i];
        ans += quot;
    }

    cout << ans + (n / 10LL) << endl;

    return 0;
}

Measured memory_bytes: 256
n,t = gets.split.map(&:to_i)
list = (1..n).map{gets.split.map(&:to_i)}.sort
tm = t-1
dp = [0]*(t)
ans = 0
list.each{|a,b|
  if ans < tmpans=dp[tm]+b
    ans = tmpans
  end
  dp2=[0]*a+dp
  (a..tm).each{|ti|
    if dp[ti] < dpb=dp2[ti]+b
      dp[ti] = dpb
    end
  }
}
p ans

Measured memory_bytes: 71280
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"\Case #"<<x<<"\:"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}


void virus(){
        ll x,n;
        cin>>x>>n;
        ll left = x, right = x;
        
        vector<ll> arr(n);
        for(auto &i:arr) cin>>i;
        while(true){
            if(find(arr.begin(),arr.end(),left) == arr.end()){
                cout<<left;
                return;
            }
            else left--;
            if(find(arr.begin(),arr.end(),right) == arr.end()){
                cout<<right; return;
            }
            else right++;
        }
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3652
// One Batch Two Batch Penny and Dime

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define hii cout << "hii" << endl
#define int long long
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int N = 5e5 + 5;
const int MAX = 250000 + 5;
const int M = 1e6 + 5;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e18 + 8;
const int LG = 21;

int arr[M];

void solve()
{
	string input;
	cin >> input;
	if(input.back() == 's') input += "es";
	else input += "s";
	cout << input << endl;
}


 
int32_t main() 
{	
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 3652
N, M = map(int, input().split())
C = [tuple(map(int, input().split())) for _ in range(N)]

ans = 0
for i in range(2 ** 3):
    F = [1, 1, 1]
    for j in range(3):
        if ((i >> j) & 1):
            F[j] = -1

    s = []
    for x, y, z in C:
        s.append(x*F[0]+y*F[1]+z*F[2])
    s = sorted(s, reverse=True)

    ans = max(ans, sum(s[:M]))
print(ans)


Measured memory_bytes: 68452
import java.util.*

fun main(args: Array<String>) {

    val n = Integer.parseInt(readNext())

    val a = readNext().split(" ").map { Integer.parseInt(it) }

    val b = readNext().split(" ").map { Integer.parseInt(it) }

    val c = readNext().split(" ").map { Integer.parseInt(it) }
    var result = 0
    var pren = 0;
    for (i in 0..n - 1) {
        val n = a[i]
        result += b[n -1]
        if (pren + 1 == n && i != 0) {
            result += c[pren-1]
        }
        pren = n

    }
    println(result)
}
fun readNext(): String {
    return readLine()!!
}

Measured memory_bytes: 35948
#include <cassert>
#include <algorithm>
#include <cctype>
#include <complex>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <typeinfo>
#include <unordered_set>
#include <unordered_map>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REPD(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define PB(e) push_back(e)
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

bool ok(const vector<int> &A, ll M, ll V, ll P, int index) {
  if (index < P) {
    return true;
  }

  if (A[P - 1] > A[index] + M) {
    return false;
  }

  ll rest = M * V;
  REP(i, A.size()) {
    if (i == index) {
      rest -= M;
    } else if (i < P - 1) {
      rest -= M;
    } else {
      rest -= min(max<ll>(A[index] + M - A[i], 0), M);
    }
    // cout << A << " " << P << " " << index << " "  << rest << " " << A.size() << " " << i << endl;

  }
  // cout << A << " " << P << " " << index << " "  << rest << " " << A.size() << endl;
  return rest <= 0;
}

int main(int argc, char *argv[]) {

  int N, M, V, P;
  cin >> N >> M >> V >> P;
  vector<int> A(N);
  REP(i, N) {
    cin >> A[i];
  }
  sort(ALL(A), greater<int>());
  // cout << A << endl;

  int ub = N;
  int lb = 0;
  while ((ub - lb) > 1) {
    int mb = (ub + lb) / 2;
    if (ok(A, M, V, P, mb)) {
      lb = mb;
    } else {
      ub = mb;
    }
  }
  cout << ub << endl;
}


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

using namespace std;

const int SIZE=5e5;
int n,q;
char s[SIZE];
vector<bitset<26> >cay;
map<int,int>f;
int check,t1,t3;
char t2;

void xaycay(int node,int l,int r)
{
    if(l==r)
    {
        cay[node]=0;
        cay[node][s[l]-'a']=1;
        f[r]=node;

        return ;
    }
    int mid=(l+r)/2;

    xaycay(node*2,l,mid);
    xaycay(node*2+1,mid+1,r);
    cay[node]= cay[node*2] | cay[node*2+1];

    return ;
}

bitset<26>tk(int node,int l,int r,int t,int p)
{
    if(t>r||p<l)
        return 0;
    if(t<=l&&r<=p)
        return cay[node];
    int mid=(l+r)/2;
    return tk(node*2,l,mid,t,p) | tk(node*2+1,mid+1,r,t,p);
}
void change(int node,int l,int r,int T1,int T2)
{
    if(l>T1||r<T1)
        return ;
    if(l==T1&&T1==r)
    {
        cay[node][s[T1]-'a']=0;
        cay[node][T2-'a']=1;
        return ;
    }
    int mid=(l+r)/2;
    change(node*2,l,mid,T1,T2);
    change(node*2+1,mid+1,r,T1,T2);

    cay[node]=cay[node*2] | cay[node*2+1];

    return ;
}
int main()
{
    //freopen("157E.INP","r",stdin);

    cin>>n>>s>>q;

    cay.resize(n*4+9);

    xaycay(1,0,n-1);

    cay[0]=0;
    while(q--)
    {
        cin>>check>>t1;
        if(check==1)
        {
            cin>>t2;
            change(1,0,n-1,t1-1,t2);
            s[t1-1]=t2;
        }
        else
        {
            cin>>t3;
            bitset<26> tye=tk(1,0,n-1,t1-1,t3-1);
            int d=0;
            for(int i=0; i<26; i++)
                if(tye[i]==1)
                    d++;
            cout<<d<<endl;
        }
    }
    return 0;
}


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

bool is_prime(int num) {
    for (int j = 2; j * j <= num; ++j) {
        if (num % j == 0) return false;
    }
    return true;
}

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

    int n;
    cin >> n;
    
    int cnt = 0;
    for (int i = 11; i < 55555; ++i) {
        if (i % 5 == 1 && is_prime(i)) {
            printf("%d ", i);
            if (++cnt == n) break;
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void PrintArray(int a[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		printf("%d", a[i]);
		if (!(i - N + 1)) break;
		printf(" ");
	}
	printf("\n");
}

void swap(int a[], int i, int j) {
	int buff = a[i];
	a[i] = a[j];
	a[j] = buff;
}

void SelectionSort(int a[], int N) {
	int mini, cnt = 0;
	for (int i = 0; i < N; i++) {
		mini = i;
		for (int j = i + 1; j < N; j++) {
			if (a[mini] > a[j]) mini = j;
		}
		if (mini - i)
		{
			swap(a, i, mini);
			cnt++;
		}
	}
	PrintArray(a, N);
	printf("%d\n", cnt);
}

int main() {
	int a[100], N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)scanf("%d", &a[i]);
	SelectionSort(a, N);


	return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i=0; i<(int64_t)(n); i++)
#define all(v) v.begin(), v.end()
//d
int main(){
  
  int64_t N, K; cin >> N >> K;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  vector<bool> reached(N);
  rep(i, N) reached[i] = false;
  reached[0] = true;
  int64_t k = K;
  
  int64_t start = 0;
  int now = 1;
  rep(i, N){
    now = A[now-1];
    if(reached[now-1]) break;
    else{
      reached[now-1] = true;
      start++;
    }
  }
  
  K -= start;
  
  rep(i, N) reached[i] = false;
  reached[now-1] = true;
  int64_t count = 1;
  rep(i, N){
    now = A[now-1];
    if(reached[now-1]) break;
    else{
      reached[now-1] = true;
      count++;
    }
  }
  
  K %= count;
  
  int ans=1;
  if(k<=start) rep(i, k) ans = A[ans-1];
  else rep(i, start+K) ans = A[ans-1];
  
  cout << ans << endl;
  
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int n,l;
    cin>>n>>l;
    int a[n];
    int mn=1e9,id=-1,s=0;
    for(int i=0;i<n;i++)
    {
        a[i]=l+i;
        s+=a[i];
        if(mn>abs(a[i]))
        {
            mn=abs(a[i]);
            id=i;
        }
    }
    cout<<s-a[id]<<endl;
}
 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<functional>
#include<stack>
#include<list>
#include<set>
#include<deque>
#include<climits>
using namespace std;

int ans;

void Dfs(vector<int> way[100],bool used[100],int n,int d){
	//printf("%d,%d\n",n,d);
	if(used[n]) return;
	used[n] = true;
	ans = max(ans,d);
	for(int i=0;i<way[n].size();i++){
		Dfs(way,used,way[n][i],d+1);
	}
	used[n] = false;
}

int main(){
	int N,A,B;
	while(cin>>N,N){
		ans = 0;
		vector<int> way[100];
		for(int i=0;i<N;i++){
			cin>>A>>B; A--; B--;
			way[A].push_back(B);
			way[B].push_back(A);
		}
		bool used[100]={};
		for(int i=0;i<100;i++){
			Dfs(way,used,i,1);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1204
w = gets.chomp
app = {}
w.each_char do |ch|
  if app.key?("#{ch}")
    app["#{ch}"] += 1
  else
    app["#{ch}"] = 1
  end
end
answer = "Yes"
if app.size == 0
  puts answer
else
  app.each do |key, value|
  	if value % 2 != 0
      answer = "No"
    end
  end
  puts answer
end

Measured memory_bytes: 3836
#include<cstdio>
#include<iostream>
using namespace std;
#define ull unsigned long long
ull a, b, ans;

ull gcd(ull a, ull b){
	return b == 0 ? a : gcd(b, a % b);
}

ull lcm(ull a, ull b, ull GCD){
	a = a / GCD;
	b = b / GCD;
	return a * b * GCD;
}


int main(){
	while(cin>>a>>b){
		ans = gcd(a, b);
		cout<<ans<<" "<<lcm(a, b ,ans)<<endl;
	}
	return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    ll n;
    cin>>n;
    if(n%2==1)
        cout<<"0";
    else{
        ll fac=5,sum=0;
        sum+=(n/10);
        n/=10;
        for(int i=1;i<=25;i++){
            sum+=(n/fac);
            fac*=5;
        }
        cout<<sum;

    }



}


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

    int N,M,C; cin >> N >> M >>C;
    int Bs[M]; rep(i,0,M) cin >> Bs[i];
    int featureValues[N][M];
    int ans = 0;
    int sum = 0;
    
    rep(i,0,N){
        rep(j,0,M){
            cin >> featureValues[i][j];
        }
    }


    rep(i,0,N){
        sum = 0;
        rep(j,0,M){
            sum = sum+(Bs[j]*featureValues[i][j]);
        }
        if((sum + C) > 0) ans++;
    }

    cout << ans << endl;


}



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

int main(){

    int a,b,count=0; cin>>a>>b;

    for(int i=a; i<= b; i++){

        int fir = i % 10, sec= i/10000 % 10;
        int thi = i / 10 % 10 , four = i / 1000%10;

        if(fir == sec && thi == four) count++; 
    }

    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        for(int i = 1; i<10000000; i++){
            int val1 = (int) (0.08 * i);
            int val2 = (int) (0.1 * i);
            if(val1 == a && val2 == b){
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 23892
n = int(input())
points = [[int(i) for i in input().split()] for _ in range(n)]

import functools
import itertools
import math

@functools.lru_cache()
def dist_calc(p1, p2):
    return math.sqrt((points[p1][0] - points[p2][0]) ** 2 + (points[p1][1] - points[p2][1]) ** 2)

dist = []
for route in itertools.permutations(range(n)):
    for i in range(n-1):
        dist.append(dist_calc(route[i], route[i+1]))

print(sum(dist)/math.factorial(n))


Measured memory_bytes: 49768
"""memo
    トポロジカルソート「http://zehnpaard.hatenablog.com/entry/2018/06/26/201512」
    をしてから，dpで求めた．（ソートと同時にdp求められそう）
"""
from collections import deque, defaultdict
import sys
input == sys.stdin.readline

def main():
    v, n = map(int, input().split())
    es = [[int(x) for x in input().split()] for _ in range(n)]

    outs = defaultdict(list)
    ins = defaultdict(int)
    #print(ins)
    for v1, v2 in es:
        outs[v1].append(v2)
        ins[v2] += 1
        #print(ins)
    #print("be",ins)
    q = deque(v1 for v1 in range(1,v+1) if ins[v1] == 0) #rangeは無駄なものがない
    #print("af",ins)
    res = []
    #print(outs)
    #print(ins)
    dp = [0]*(v+1)
    while q:
        #print(q)
        v1 = q.popleft()
        res.append(v1)
        for v2 in outs[v1]: #v1のノードから出ている矢印をみる．
            dp[v2] = dp[v1] + 1
            #print("-->",v2)
            ins[v2] -= 1
            if ins[v2] == 0: #v2のノードに入る矢印をすべて見たときにqに追加
                #print("<--",v2)
                q.append(v2)
    #print(res[1:])
    #print(outs)
    #print(ins)

    print(max(dp))

if __name__ == '__main__':
    main()

Measured memory_bytes: 49536
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,z,w=map(int,input().split())
    A=list(map(int,input().split()))
    if(n==1):
        print(abs(A[0]-w))
    else:
        print(max(abs(A[-1]-w),abs(A[-2]-A[-1])))
resolve()

Measured memory_bytes: 38640
n= int(input())
gsb = [tuple(map(int,input().split())) for _ in range(2)]

def increase(num, gsb0, gsb1):
    dp = [ [num] * (num+1) for _ in range(3+1)]
    for i in range(1,4):
        w = gsb0[i-1]
        v = gsb1[i-1]
        for j in range(num+1):
            if(j < w):
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = max(dp[i-1][j], dp[i][j-w] + v-w)

    return(dp[-1][-1])

num = increase(n,gsb[0],gsb[1])
num = increase(num,gsb[1],gsb[0])

print(num)

Measured memory_bytes: 814876
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 1) {
        cout << n << endl;
        cout << "0" << endl;
    } else if(n == 2) {
        cout << n << endl;
        cout << "0" << endl;
        cout << "11" << endl;
    } else {
        vector<string> ans;
        for(int i = 0; i < n - 1; i++) {
            string tmp = "";
            for(int j = 0; j < i; j++) {
                tmp += "1";
            }
            tmp = "0" + tmp;
            tmp += "0";
            ans.push_back(tmp);
        }
        cout << ans.size() << endl;
        for(auto i : ans) {
            cout << i << endl;
        }
    }
}


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

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    try {
      input.readLine();
    } catch (IOException e1) {
      e1.printStackTrace();
    }
    try {
      while (input.ready()) {
        String[] dataset = input.readLine().split(" ");

        System.out.println(
            isRightTriangle(Integer.valueOf(dataset[0]), Integer.valueOf(dataset[1]), Integer.valueOf(dataset[2])));
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  public static String isRightTriangle(int a, int b, int c) {

    ArrayList<Integer> sideArray = new ArrayList<>();
    sideArray.add(a);
    sideArray.add(b);
    sideArray.add(c);

    Collections.sort(sideArray);

    if (sideArray.get(0) * sideArray.get(0) + sideArray.get(1) * sideArray.get(1) == sideArray.get(2)
        * sideArray.get(2))
      return "YES";
    else
      return "NO";
  }
}

Measured memory_bytes: 25832
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n % 2) --n;
    int max = 0;
    int cnt = 0;
    int ans = 1;
    for (int i = n; i > 0; i -= 2) {
        int x = i;
        while (x % 2 == 0) {
            ++cnt;
            x /= 2;
        }
        if (max < cnt) {
            ans = i;
            max = cnt;
        }
        cnt = 0;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
	string s, t; cin >> s >> t;
	string s1, s2;
	for (int i = 0; i < s.size(); ++i) {
		if (i & 1) s1 += s[i];
		else s2 += s[i];
	}
	int now1 = 0, now2 = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s1[now1] == t[i]) now1++;
		if (s2[now2] == t[i]) now2++;
	}
	if (now1 == s1.size() || now2 == s2.size()) cout << "Yes" << endl;
	else cout << "No" << endl;
	

	return 0;
}


Measured memory_bytes: 3192