akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <cstring>
#include <vector>
using namespace std;
#define i64 int64_t
void d()
{
  i64 a, b;
  cin >> a >> b;
  i64 count[64];
  memset(count, 0, sizeof(count));
  for (i64 i = a; i <= b; i++)
  {
    for (int j = 0; j < 64; j++)
    {
      if (i & (1ll << j))
      {
        count[j]++;
      }
    }
  }
  i64 sum = 0;
  for (int i = 0; i < 64; i++)
  {
    if (count[i] % 2 != 0)
    {
      sum += (1ll << i);
    }
  }
  cout << sum;
}
void c()
{
  i64 n, m;
  cin >> n >> m;
  map<i64, i64> ab;
  for (int i = 0; i < n; i++)
  {
    i64 a, b;
    cin >> a >> b;
    auto itr = ab.find(a);
    if (itr == ab.end())
    {
      ab[a] = b;
    }
    else
      ab[a] += b;
  }
  i64 sum_x = 0;
  i64 sum_y = 0;
  for (auto itr = ab.begin(); itr != ab.end(); itr++)
  {
    //cout << itr->first << " " << itr->second << endl;
    if (m - sum_x - itr->second > 0)
    {
      sum_x += itr->second;
      sum_y += itr->second * itr->first;
    }
    else
    {
      sum_y += (m - sum_x) * itr->first;
      sum_x += m - sum_x;
    }
    if (sum_x == m)
      break;
  }
  cout << sum_y;
}
void b()
{
  int n, m, c;
  cin >> n >> m >> c;
  int b[m], a[n][m];
  for (int i = 0; i < m; i++)
    cin >> b[i];
  for (int j = 0; j < n; j++)
  {
    for (int i = 0; i < m; i++)
      cin >> a[j][i];
  }
  int count = 0;
  for (int j = 0; j < n; j++)
  {
    int sum = c;
    for (int i = 0; i < m; i++)
      sum += a[j][i] * b[i];
    if (sum > 0)
      count++;
  }
  cout << count;
}
int main(void)
{
  b();
  //c();
  //d();
  return 0;
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto B = new string[](N);
    foreach (i; 0 .. N)
        B[i] = sread();
    long M = lread();
    auto R = new string[](M);
    foreach (i; 0 .. M)
        R[i] = sread();
    long[string] d;
    foreach (b; B)
        d[b] = d.get(b, 0) + 1;
    foreach (r; R)
        d[r] = d.get(r, 0) - 1;
    long ans = 0;
    foreach (k, v; d)
        ans = ans.max(v);
    writeln(ans);
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<double> E(N);
    rep(i, N){
        double p;
        cin >> p;
        E[i] = (1+p) / 2;
    }
    double tmp = 0;
    rep(i, K){
        tmp += E[i];
    }
    double ans = tmp;
    rep(i, N-K){
        tmp = tmp - E[i] + E[i+K];
        ans = max(ans, tmp);
    }
    cout << fixed << setprecision(10);
    cout << ans;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
// 多倍長整数型
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
 
#define INF 1e9
#define LINF 1e18
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll ZER = 0;



int main(){
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int> (n));
  rep(i, n)rep(j, n){
    if(j != n - 1)cin >> a[i][j];
    else a[i][j] = INF + 1;
    a[i][j]--;
  }

  int res = 0;
  vector<int> now(n, 0);
  while(1){
    vector<bool> seen(n, false);
    rep(i, n){
      if(seen[i] || now[i] >= n)continue;
      int j = a[i][now[i]];
      if(j == INF)continue;
      if(i == a[j][now[j]] && j == a[i][now[i]] && seen[j] == false){
        seen[i] = true;
        seen[j] = true;
        now[i]++;
        now[j]++;
      }
    }
    bool alf = true;
    bool clr = true;
    rep(i, n){
      //cout << now[i] << " ";
      if(seen[i])alf = false;
      if(now[i] < n - 1)clr = false;
    }
    //cout << endl;
    if(clr)break;
    if(alf){
      cout << -1 << endl;
      return 0;
    }
    res++;
  }
  cout << res + 1 << endl;
}
 

Measured memory_bytes: 7072
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const MOD int64 = int64(1e9+7)
var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var tonari = make([][]int, 200010)

func dfs( node int, connected []bool) int {
	ret := 0
	for _, i := range tonari[node] {
		if connected[i]	{
			continue
		}
		connected[i] = true
		ret += dfs(i, connected)+1
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	M := nextInt()
	connected := make([]bool, N, N)
	var a,b int
	for i := 0; i < M; i++ {
		a = nextInt()
		b = nextInt()
		a--; b--
		tonari[a] = append(tonari[a],b)
		tonari[b] = append(tonari[b],a)
	}
	ans := 1
	for i:=0; i<N; i++ {
		if connected[i] {
			continue
		}
		if cnt := dfs(i, connected); ans < cnt{
			ans = cnt
		}
	}
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 64580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; }}
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; }}
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int dp[3100][3100] = { 0 };

int main() {
    string s, t;
    cin(s); cin(t);

    rep2(i, s.size()) {
        rep2(j, t.size()) {
            if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);
        }
    }

    string res = "";
    ll i = s.size(), j = t.size();

    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            --i;
        } else if (dp[i][j] == dp[i][j - 1]) {
            --j;
        } else {
            res = s[i - 1] + res;
            --i; --j;
        }
    }

    print(res);
    return 0;
}

Measured memory_bytes: 37120
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> PII;
#define MOD (1000000007ll)

int main(void){
	int n,a,b;
	cin >> n >> a >> b;
	cout << (min(n*a,b)) << endl;
	return 0;
}

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

struct query{
  int type;//0=empty, 1=add
  ll value;
  query(int a=0,ll b=0):type(a),value(b) {}
};

query s[(1<<18)];
ll t[(1<<18)];

void compute(int k,int l,int r){
  query q=s[k];
  s[k].type=s[k].value=0;
  if(q.type==0||r-l==1)return;
  
  int m=(l+r)/2;
  
  s[k*2+1].type=1;
  s[k*2+1].value+=q.value;
  t[k*2+1]+=q.value*(m-l);
  
  s[k*2+2].type=1;
  s[k*2+2].value+=q.value;
  t[k*2+2]+=q.value*(r-m);
}

void Add(int a,int b,ll x,int k=0,int l=0,int r=(1<<17)){
  if(b<=l || r<=a)return;
  compute(k,l,r);
  if(a<=l && r<=b){
    s[k]=query(1,x);
    t[k]+=x*(r-l);
  }else{
    int m=(l+r)/2;
    Add(a,b,x,k*2+1,l,m);
    Add(a,b,x,k*2+2,m,r);
    t[k]=t[k*2+1]+t[k*2+2];
  }
}

ll Get(int a,int b,int k=0,int l=0,int r=(1<<17)){
  if(b<=l || r<=a)return 0;
  compute(k,l,r);
  if(a<=l && r<=b){
    return t[k];
  }else{
    int m=(l+r)/2;
    ll lv=Get(a,b,k*2+1,l,m);
    ll rv=Get(a,b,k*2+2,m,r);
    return lv+rv;
  }
}



int main(){

  int n,q,type,a,b,x;
  scanf("%d %d",&n,&q);
  
  while(q--){
    scanf("%d",&type);
    if(type==0){
      scanf("%d %d %d",&a,&b,&x);
      b++;
      Add(a,b,x);
    }else{
      scanf("%d %d",&a,&b);
      b++;
      printf("%lld\n",Get(a,b));
    }
  }
  return 0;
}

Measured memory_bytes: 8860
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int main() {
  int n;
  cin >> n;
  vector<ll> wa(n, 0);
  map<ll, ll> sa;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    wa[i] += (i + a);
    if (i - a >= 0) {
      sa[i-a]++;
    }
  }
  ll count = 0;
  for (int i = 0; i < n; i++) {
    count += sa[wa[i]];
  }
  printf("%lld\n", count);
}

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

int C[30] = {};


int main() {
	string w;
	cin >> w;

	for (int i = 0; i < w.size(); i++) {
		for (int j = 0; j < 26; j++) {
			if (w[i] == (char)('a' + j)) C[j]++;
		}
	}

	for (int i = 0; i < 26; i++) {
		if (C[i] % 2 == 1) {
			cout << "No" << endl;
			break;
		}
		if (i == 25) cout << "Yes" << endl;
	}
	return 0;
}

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

int main()
{    
    int n,q;
    cin >> n >> q;
    vector<vector<int>> g(n);
    rep(i,n-1) {
        int a,b;
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    vector<int> x(n, 0);
    rep(i,q) {
        int qi,xi;
        cin >> qi >> xi;
        x[qi-1] += xi;
    }

    vector<int> cnt(n, 0);
    vector<bool> seen(n,false);
    queue<int> que;
    que.push(0);
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        seen[v] = true;
        cnt[v] += x[v];
        for(auto nv:g[v]) {
            if(seen[nv]) continue;
            cnt[nv] += cnt[v];
            que.push(nv);
        }
    }

    rep(i,n) cout << cnt[i] << " ";
    cout << endl;
    return 0;
}

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



int minCost(int i, vector<int> &dp,vector<int> &h,int k, int n){
    if(dp[i] != -1){
        return dp[i];
    }
    if(i>=n-1){
        return 0;
    }
    
    int   ret = INT_MAX;
 
    // for(int j = 1;j<=k; j++){
    // if(i+j<=n) ret = min (ret,  abs(h[i]-h[i+j])+minCost(i+j, dp,h,k,n));}

    int ans = INT_MAX;
    for(int j = i+1;j<=i+k && j< n;j++){
        ans = min(ans, minCost(j,dp,h,k,n)+ abs(h[j]-h[i]));
    }
    return dp[i]=ans;
}

int main() {
    
     int k,n;

    cin>>n>>k;
    vector<int> h(n+1,0);
    if(n==0)
    return 0;
    int temp;
    for(int i=0;i<n;i++){
        cin>>temp;
        h[i]=temp;
    }
    vector<int> dp(n+1,-1);
    cout<<minCost(0,dp,h,k,n);
    //cout<<dp[0];
     return 0;
    
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int x=0,y=0,sum=0;
	    int N=sc.nextInt();
	    
	    if(N>=15){
	        y = 200*(N/15);
	    }
	    
	    x =800*N;
	    sum = x-y;
	    System.out.println(sum);
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, int> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = 100005;
int n, m, l[MX], r[MX], c[MX];
ll dp[MX];
vi pos[MX];
priority_queue<ii, vii, greater<ii>> pq;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> l[i] >> r[i] >> c[i];
		pos[r[i]].pb(i);
	} 

	memset(dp, -1, sizeof(dp));
	dp[n] = 0;
	
	for (int i = n; i; i--) {
		while (pq.size() && pq.top().se > i)
			pq.pop();

		if (pq.size())
			dp[i] = pq.top().fi;
		
		if (dp[i] == -1) {
			cout << -1 << endl;
			return 0;
		}

		for (int j : pos[i])
			pq.emplace(dp[i] + c[j], l[j]);
	}

	cout << dp[1] << endl;

	return 0;
}


Measured memory_bytes: 8436
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
bool b[200000];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    vector<ll> A;
    rep(i,0,N) {
        ll a;
        cin>>a;
        A.push_back(a);
    }
    sort(A.begin(), A.end());
    ll ans=0;
    rer(i,31,1){
        int j=0;
        int k=N-1;
        ll t=ll(1)<<(i-1);
        while(A[j]<=t&&j<=N-1){
            if(b[j]==0){
                while(A[k]>2*t-A[j]||(b[k]==1&&A[k]==2*t-A[j])) k--;
                if(A[k]==2*t-A[j]&&k>j&&b[k]==0){
                    b[j]=1;
                    b[k]=1;
                    ans++;
                }
            }
            j++;
        }
    }
    cout <<ans<<"\n";
}


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

using namespace std;

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

int main(){
    int i;
    //入力
    int  h,a;
    cin>>h>>a;
    //処理
    //出力
    h%a>0? cout<<h/a+1<<endl: cout<<h/a<<endl;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  long long a, b, n;
  cin >> a >> b >> n;

  // for (int i = 0; i < n; ++i) {
  // int res = floor(a * i / b) - a * floor(i / b);
  // cout << i << ' ' << res << '\n';
  // }
  long long x = min(n, b - 1);
  long long res = floor(a * x / b) - a * floor(x / b);
  cout << res << '\n';
  return 0;
}

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

using namespace std;

#define sz(a) (int)(a).size()
#define pb push_back
typedef long long ll;

void solve() {
    ll n, k;
    cin >> n >> k;

    vector<ll> a(n);
    for (auto &i : a) cin >> i;

    ll ans = (1ll << 60ll);
    ll i = 0, j = k - 1;
    while (j < n) {
        ll len = a[j] - a[i];

        ll tmp = min(abs(a[i]), abs(a[j])) + len;
        ans = min(ans, tmp);

        i++, j++;
    }

    cout << ans;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  x3=x2-(y2-y1);
  y3=y2+(x2-x1);
  x4=x3-(y3-y2);
  y4=y3+(x3-x2);
  cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;

	int Xcount = (N%A > 0) ? N / A + 1 : N / A;
	int Ycount = (N%C > 0) ? N / C + 1 : N / C;

	int Xprice = B * Xcount;
	int Yprice = D * Ycount;

	int minPrice = min(Xprice, Yprice);

	cout << minPrice << endl;

	return 0;
}


Measured memory_bytes: 3112
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		  ArrayList<Integer> one = nextIntArray();
		  Collections.sort(one);
		  if(one.get(0) == one.get(1) && one.get(1) != one.get(2) || 
		  	one.get(0) != one.get(1) && one.get(1) == one.get(2)){
		  	myout("Yes");
		  }else{
		  	myout("No");
		  }
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 33032
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){

  int S;
  int h, m ,s;

  scanf("%d", &S);

  h = S / 3600;
  m = (S % 3600) / 60;
  s = (S % 3600) % 60;

  printf("%d:%d:%d\n", h, m, s);
    
  return 0;
}


Measured memory_bytes: 2140
N = int(input())
s = [input() for _ in range(N)]
count = [0]*5
for i in s:
    if i[0]=="M":
        count[0] += 1
    elif i[0]=="A":
        count[1] += 1
    elif i[0]=="R":
        count[2] += 1
    elif i[0]=="C":
        count[3] += 1
    elif i[0]=="H":
        count[4] += 1
ans = 1
i = 0
h = len(count)
while i < h:
    if count[i]==0:
        count.pop(i)
        h -= 1
        i = 0
    else:
        i += 1

if len(count)<3:
    ans = 0
elif len(count)==3:
    ans = 1
    for i in count:
        ans *=  i
else:
    ans = 0
    for bit in range(1<<len(count)):
        a = []
        b = 1
        for i in range(len(count)):
            mask = 1<<i
            if mask&bit:
                a.append(count[i])
                b *= count[i] 
        if len(a)==3:
            ans +=b
    
print(ans)

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

int main(void) {
	char buffer[128];
	char* S;
	int N;
	int count;
	int i;
	if (fgets(buffer, sizeof(buffer), stdin) == NULL) return 1;
	if (sscanf(buffer, "%d", &N) != 1) return 1;
	S = malloc(N + 32);
	if (S == NULL) return 2;
	if (fgets(S, N + 32, stdin) == NULL) return 1;

	count = 1;
	for (i = 1; i < N; i++) {
		if (S[i - 1] != S[i]) count++;
	}

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

	free(S);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>

using namespace std;

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

	if (b - a <= 2) {
		cout << k + 1 << endl;
	} else {
		if (a - 1 >= k) {
			cout << k + 1 << endl;
		} else {
			long long now = a;
			k = k - a + 1;

			if (k % 2 == 0) {
				now += (b - a) * (k / 2);
				cout << now << endl;
			} else {
				now += (b - a) * (k / 2);
				cout << now + 1 << endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 100005;
const int mod = (int) 1e9 + 7;

int a, b;
int fac[N];

int main() {
  cin >> a >> b;
  fac[0] = 1;
  if (abs(a - b) > 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i < N; i++) {
    fac[i] = (1ll * i * fac[i - 1]) % mod;
  }
  int ans = ((1ll * (1 + ((a + b) % 2 == 0))) * fac[a] * fac[b]) % mod;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
ll MOD = 1e9 + 7;
const ld E = 1e-7;
#define null NULL
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl "\n"
#endif
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".in"); _write(x ".out")
#define filesdatsol(x) _read(x ".DAT"); _write(x ".SOL")
#define output _write("output.txt")
#define input _read("input.txt")
#define mod % MOD
#define y1 hello_world
unsigned char ccc;
bool _minus = false;
template<typename T>
inline T sqr(T t) {
	return (t * t);
}
inline void read(ll &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
inline void read(int &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
char wwww[19];
int kkkk;
inline void write(ll y) {
	long long x = y;
	kkkk = 0;
	if (!x)
		++kkkk, wwww[kkkk] = '0';
	else
		while (x) {
			++kkkk;
			wwww[kkkk] = char(x % 10 + '0');
			x /= 10;
		}
	for (int i = kkkk; i >= 1; --i)
		putchar(wwww[i]);
	putchar('\n');
}

#ifdef LOCAL
//#define DEBUG
#endif


int main() {
	srand(time(NULL));
	cout.precision(10);
	cout << fixed;
	sync;
#ifdef LOCAL
	input;
#else

#endif

	string s;
	cin >> s;

	map<char, bool> m;
	for(int i = 0; i < (int) s.size(); i++)
		m[s[i]] = true;
	if((m['S'] ^ m['N']) || (m['E'] ^ m['W'])){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
}


Measured memory_bytes: 256
N = int(input())
C = {i:0 for i in range(1,N+1)}
for x in range(1,142):
    for y in range(1,142):
        for z in range(1,142):
            a = (x+y)**2+(y+z)**2+(z+x)**2
            if a%2==0 and a//2<=N:
                C[a//2] += 1
for i in range(1,N+1):
    print(C[i])


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

int main() {
  
  int N , A , B;
  cin >> N >> A >> B;
  
  int plan1 , plan2;
  plan1 = A * N;
  plan2 = B;
  
  if (plan1 >= plan2) cout << plan2 << endl;
  else cout << plan1 << endl;
  
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

    int m[200005]; //num, pos
    rep(i,n){
        int a;
        cin >> a;
        m[a] = i;
    }

    set<int> pos;
    pos.insert(-1);
    pos.insert(n);
    long long ans = 0;
    range(i,1,n + 1){
        int cur = m[i];

        auto it = pos.upper_bound(cur);
        int left = cur - *prev(it,1);
        //show(left)
        long right = *it - cur;
        //show(right)

        ans += 1LL * left * right * i;
        //show(ans)
        pos.emplace(cur);
    }
    cout << ans << endl;
}


Measured memory_bytes: 10368
#include <iostream>
#include <set> 
#include <iterator>
#include <bitset> 
#include <bits/stdc++.h> 
using namespace std;
typedef  long long int ll;
ll mod=1000000007;


int main() {
    int t1=1;
    //cin>>t;
    while(t1--)
    { int n,x,t;
        cin>>n>>x>>t;
        int z=n/x;
        if(n%x==0)
            cout<<z*t<<endl;
        else
            cout<<z*t+t<<endl;
            
            
    }
	return 0;
}


Measured memory_bytes: 3632
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
s = collections.Counter(s)
s = s.most_common()
c = s[0][1]
ans = []
for i in range(len(s)):
    if s[i][1] == c:
        ans.append(s[i][0])
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 43476
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using ll = long long;

int N, F[100][10], P[100][11];

int main() {
    cin >> N;
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < 10; ++k) cin >> F[j][k];
    }
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k <= 10; ++k) cin >> P[j][k];
    }

    int ans = -1;
    for (int n = 1; n < (1 << 10); ++n) {
        int open[10];
        for (int j = 0; j < 10; ++j) {
            open[j] = (n & (1 << j)) != 0 ? 1 : 0;
        }

        int score = 0;
        for (int j = 0; j < N; ++j) {
            int v = 0;
            for (int k = 0; k < 10; ++k) {
                v += (F[j][k] && open[k]) ? 1 : 0;
            }
            score += P[j][v];
        }

        ans = (ans == -1) ? score : max(ans, score);
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int n;
    while(1){
	cin >> n;
	if (cin.eof()) break;
	int cmb = 0;
	for (int i = 0; i < 10; i++)
	    for (int j = 0; j < 10; j++)
		for (int k = 0; k < 10; k++)
		    for (int l = 0; l < 10; l++)
			if (i + j + k + l == n) cmb++;
	cout << cmb << endl;
    }
}

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

int main()
{
	int n;
  	cin >> n;
  	if(n % 10 == 0)
    {
    	cout << "pon" << endl;
    }
  	else if(n % 10 == 1)
    {
    	cout << "pon" << endl;
    }
  	else if(n % 10 == 2)
    {
    	cout << "hon" << endl;
    }
  	else if(n % 10 == 3)
    {
    	cout << "bon" << endl;
    }
  	else if(n % 10 == 4)
    {
    	cout << "hon" << endl;
    }
  	else if(n % 10 == 5)
    {
    	cout << "hon" << endl;
    }
  	else if(n % 10 == 6)
    {
    	cout << "pon" << endl;
    }
  	else if(n % 10 == 7)
    {
    	cout << "hon" << endl;
    }
  	else if(n % 10 == 8)
    {
    	cout << "pon" << endl;
    }
  	else if(n % 10 == 9)
    {
    	cout << "hon" << endl;
    }
}

Measured memory_bytes: 3632
import java.util.Scanner;

class Main {
    static Scanner sc;

    private static void nextArr(int[] h) {
        for(int i = 0; i < h.length; i++) h[i] = sc.nextInt();
    }

    private static int nextInt() {
        return sc.nextInt();
    }

    private static void print(Object... vals) {
        for(int i = 0; i < vals.length; i++) {
            if (i != vals.length - 1) {
                System.out.print(vals[i] + ",");
            } else {
                System.out.print(vals[i]);
            }
        }
        System.out.println();
    }

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] p = new double[n];
        for(int i = 0; i < n; i++) p[i] = sc.nextDouble();

        double[][] dp = new double[n + 1][n + 1];
        dp[1][1] = p[0];
        for(int i = 2; i <= n; i++) dp[1][i] = 0;
        for(int i = 2; i <= n; i++) {
            double prod = 1;
            for(int j = 1; j <= i; j++) prod *= (1 - p[j - 1]);
            for(int j = 1; j <= i; j++) {
                dp[i][1] += ((prod  * p[j - 1])/ (1 - p[j - 1]));
            }
        }
        for(int i = 2; i <= n; i++) {
            for(int j = 2; j<= n; j++) {
                dp[i][j] = p[i - 1] * dp[i - 1][j - 1] + (1 - p[i - 1]) * dp[i - 1][j];
            }
        }

        double ans = 0;
        for(int i = (n + 1) / 2; i <= n; i++) {
            ans += dp[n][i];
        }
        print(ans);
    }
}


Measured memory_bytes: 123060
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    vector<int> a(3);
    rep(i, 3) cin >> a[i];
    sort(all(a));
    cout << a[2] - a[0] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
  int i,ans = 0;
  char S[17],dash[17] = "CODEFESTIVAL2016";
  scanf("%s",S);
  for (i = 0;i < 16;i++) {
    if (S[i] != dash[i]) ans++;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(b%2==1)
	{
		printf("No");
		return 0;
	}
	
	int c = 2*a;
	int d = 4*a;
	if(c<=b&&b<=d) printf("Yes");
	else printf("No");
}

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

using namespace std;

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

// 45106 - 111

// 77 - 16 41


void oneCase() {
    char a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    auto ok = a == f && b == e && c == d;

    cout << (ok ? "YES\n" : "NO\n");




}


int main() {
    int t = 1;
//    cin >> t;
    while (t--) {
       oneCase();
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

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

    ll n;
    cin >> n;

    vector<ll> count(n,0);
    ll temp;
    rep(i,n){
        temp = 1;
        while((i+1) * temp <= n){
            count[temp * (i+1)-1]++;
            temp++;
        }
    }
    
    ll result = 0;
    rep(i,n){
        // cout << count[i] << "\n";
        result += count[i] * (i+1);
    }

    cout << result;

}

Measured memory_bytes: 81324
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	k := getNextInt(scanner)
	r := n - k

	var cm CombinationMod
	cm.init(n)

	for i := 1; i <= k; i++ {
		if r+1 < i {
			fmt.Fprintln(writer, 0)
			continue
		}
		ans := cm.calc(r+1, i)
		ans = (ans * cm.calc(k-1, i-1)) % cm.mod
		fmt.Fprintln(writer, ans)
	}

	writer.Flush()
}

// CombinationMod ...
type CombinationMod struct {
	n, mod   int64
	fac, inv []int64
}

func (cm *CombinationMod) init(n int) {
	cm.n = int64(n)
	cm.fac = make([]int64, n+1)
	cm.inv = make([]int64, n+1)
	cm.fac[0] = 1
	cm.inv[0] = 1
	cm.mod = int64(10e8 + 7)
	var i int64
	for i = 1; i < cm.n+1; i++ {
		cm.fac[i] = (cm.fac[i-1] * i) % cm.mod
		cm.inv[i] = cm.calcInv(cm.fac[i])
	}
}

func (cm *CombinationMod) calcInv(n int64) int64 {
	if n == 1 {
		return 1
	}
	var a, b, x, y int64
	a = cm.mod
	b = n
	x = 1
	y = -a / b

	stack := [][]int64{
		[]int64{
			x, y,
		},
	}
	for a%b > 0 {
		a, b = b, a%b
		x = 1
		y = -a / b
		stack = append(stack, []int64{
			x, y,
		})
	}

	for i := len(stack) - 2; i > 0; i-- {
		stack[i-1][0] *= stack[i][1]
		stack[i-1][1] *= stack[i][1]
		stack[i-1][1] += stack[i][0]
	}

	ans := stack[0][1] % cm.mod
	if ans < 0 {
		ans += cm.mod
	}

	return ans
}

func (cm *CombinationMod) calc(n, m int) int64 {
	ans := (cm.fac[n] * ((cm.inv[m] * cm.inv[n-m]) % cm.mod)) % cm.mod
	return ans
}


Measured memory_bytes: 3840
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long long int sosu[1000003];
vector<long long int> sosulis;
long long int gcd(long long int a,long long int b){
    if(!b)return a;
    return gcd(b,a%b);
}
int main(){
    for(long long int i=2;i<=1000000;i++){
        if(sosu[i]==0){
            sosulis.push_back(i);
            for(int j=i*2;j<1000003;j+=i){
                sosu[j]=1;
            }
        }
    }
    long long int A,B;
    cin>>A>>B;
    long long int ans=0;
    long long int y=gcd(A,B);
    for(long long int i=1;i<=1000000;i++){
        //printf("[%d][%d]\n",i,sosu[i]);
        if(sosu[i]==0){

            if(y%i==0)ans++;
            while(y%i==0&&i!=1){
                    //printf("[%lld][%lld]\n",y,i);
                y/=i;
            }
        }
    }
    if(y!=1)ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9208
import sys
sys.setrecursionlimit(10**7)

class Node:
    def __init__(self,parent,left,right):
        self.parent = parent
        self.left = left
        self.right = right

def get_depth(T:dict,u:int):
    d = 0
    while T[u] != -1:
        u = T[u].parent
        d += 1

D = {}

def get_all_depth(T:dict,u:int,p:int):
    D[u] = p
    if T[u].right != -1:
        get_all_depth(T, T[u].right, p)
    if T[u].left != -1:
        get_all_depth(T,T[u].left,p+1)

def ret_children(T,u):
    children = []
    c = T[u].left
    while c != -1:
        children.append(c)
        c = T[c].right
    return children

def print_for_a_node(T:dict,node:int,D:dict):
    node_type = "leaf" if T[node].left == -1 else "internal node"
    if T[node].parent == -1:
        node_type = "root"
    parent = T[node].parent
    children = ret_children(T,node)
    print(f"node {node}: parent = {parent}, depth = {D[node]}, {node_type}, {children}")

n = int(input())

T = {k: Node(-1,-1,-1) for k in range(n)}

for _ in range(n):
    tmp = list(map(int,input().split()))
    if  tmp[1] == 0:
        continue
    T[tmp[0]].left = tmp[2]
    T[tmp[2]].parent = tmp[0]
    prev_sibling = tmp[2]
    for sib in tmp[3:]:
        T[prev_sibling].right = sib
        T[sib].parent = tmp[0]
        prev_sibling = sib

for node in range(n):
    if T[node].parent == -1:
        get_all_depth(T,node,0)
        break

for node in range(n):
    print_for_a_node(T,node,D)


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

    for(int i=1 ; i<=1000 ; i++){
      if(a<=(k*i) && (k*i)<=b){
        System.out.println("OK");
        break;
      }else if(i==1000){
        System.out.println("NG");
        break;
      }
    }
  }
}


Measured memory_bytes: 35764
import java.util.*;

public class Main {
    public static boolean find(String s){
        for (int i=0;i<s.length()-1;i++){
            if (s.substring(i, i + 1).equals("A") && s.substring(i+1,i+2).equals("C")){
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner re=new Scanner(System.in);
        String str=re.nextLine();
        if(find(str))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
}

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

using namespace std;

void solve(void)
{
	int n, m;
	cin >> n >> m;
	int l = 1, r = n;
	while(m--)
	{
		int a, b;
		cin >> a >> b;
		l = max(a, l);
		r = min(b, r);
	}
	cout << max(0, r - l + 1) << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,q;
  cin>>n>>m>>q;
  vector<int>a(q);
  vector<int>b(q);
  vector<int>c(q);
  vector<int>d(q);
  for(int i=0;i<q;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
  vector<int>an(n);
  int64_t sum=0,ans=0;
  
  for(an[0]=1;an[0]<=m;an[0]++){
    for(an[1]=an[0];an[1]<=m;an[1]++){
      for(an[2]=an[1];an[2]<=m;an[2]++){
        for(an[3]=an[2];an[3]<=m;an[3]++){
          for(an[4]=an[3];an[4]<=m;an[4]++){
            for(an[5]=an[4];an[5]<=m;an[5]++){
              for(an[6]=an[5];an[6]<=m;an[6]++){
                for(an[7]=an[6];an[7]<=m;an[7]++){
                  for(an[8]=an[7];an[8]<=m;an[8]++){
                    for(an[9]=an[8];an[9]<=m;an[9]++){
                      for(int i=0;i<q;i++) {
                        if(an[b[i]-1]-an[a[i]-1]==c[i]) sum += d[i];
                      }
     				  if(sum>ans)ans=sum;
                      sum=0;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3580
X,K,D=map(int,input().split())

X=abs(X)
k=min(K,X//D)
X_=X-(k*D)
K_=K-k

if K_%2!=0:
    ans=min(abs(X_-D),abs(X_+D))
else:
    ans=abs(X_)

print(ans)

Measured memory_bytes: 9192
import java.util.Scanner;

public class Main {
    static long mod = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
        long ans = pow(2, n) - comb(n, a) - comb(n, b) - 1;
        if(ans < 0) ans += (Math.abs(ans) / mod + 1) * mod; 
        System.out.println(ans);
    }
    static long pow(long x, long n) {
        long result = 1;
        while(n > 0) {
            if(n % 2 == 1) result = (result * x) % mod;
            x = (x * x) % mod;
            n >>= 1;
        }

        return result;
    }
    static long comb(long n, long r) {
        long mol = 1, den = 1;
        r = Math.min(r, n - r);
        for(long i = n - r + 1; i <= n; i++) mol = (mol * i) % mod;
        for(long i = 1; i <= r; i++) den = (den * i) % mod;
        return mol * pow(den, mod - 2) % mod;
    }
}

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

namespace AtCoderIO
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int k = int.Parse(str[2]);

            int i = a+1;
            int num = 0;
            while (num<k)
            {
                i--;
                if (a % i == 0 && b % i ==0)
                {
                    num++;
                }
            }

            Console.Write(i);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
N, M = gets.split.map(&:to_i)
abs = []
M.times do
  abs << gets.split.map(&:to_i).sort
end
ans = 0
(1..N).to_a.permutation do |ary|
  next unless ary[0] == 1
  ok = true
  for i in 1..N-1 do
    unless abs.include?([ary[i], ary[i-1]].sort)
      ok = false
      break
    end
  end
  if ok
    ans += 1
  end
end
puts ans

Measured memory_bytes: 2172
S = input()

cost1 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == '0':
            cost1 += 1
    else:
        if S[i] == '1':
            cost1 += 1

cost2 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == '1':
            cost2 += 1
    else:
        if S[i] == '0':
            cost2 += 1

print(min(cost1, cost2))


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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> xy;
    double count = 1;
    for(int i = 0;i < n;i++){
        int x, y;
        cin >> x >> y;
        xy.emplace_back(x, y);
        count *= (i + 1);
    }
    double res = 0;
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j < n;j++){
            res += hypot(xy[i].first - xy[j].first, xy[i].second - xy[j].second) * count * 2 / n;
        }
    }
    cout << setprecision(9) << res / count << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""

n = int(input())

total = 0
for i in range(1, n+1):
    if i%3==0 and i%5==0:
        continue
    elif i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        total += i

print(total)

Measured memory_bytes: 9180
def main():
    n,lim_w=map(int,input().split())
    wv = []
    for _ in range(n):
        tmp = list(map(int,input().split()))
        wv.append(tmp)
    dp = [[0] * (lim_w+1) for i in range(n+1)]

    for i in range(0, n):
        for w in range(0,lim_w+1):
            if w >= wv[i][0]:
                dp[i+1][w] = max(dp[i][w], dp[i][w-wv[i][0]] + wv[i][1])
            else:
                dp[i+1][w] = dp[i][w]

    print(dp[n][lim_w])
if __name__=='__main__':
    main()


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

int main() {
  int h,w,i,a;
  cin>>h>>w;
  vector<string>s(h*w);
  for(i=0;i<h*w;i++){
    cin>>s[i];
    if(s[i]=="snuke")a=i;
  }
  cout<<char(65+a%w)<<a/w+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 1000000007

int main(){
	int N, l, r, li = 0, ri = 0, lm = -1, rm = MOD, bm = 0;
	cin >> N;
	vector<pair<int, int>> P(N);
	for (int i = 0;i < N;i++) {
		cin >> l >> r;
		P[i] = { l,r };
		
		if (l > lm) {
			li = i;
			lm = l;
		}

		if (r < rm) {
			ri = i;
			rm = r;
		}

		bm = max(bm, r - l + 1);
	}

	int lir = P[li].second;
	int ril = P[ri].first;

	sort(all(P));

	int ans = bm + max(0, rm - lm + 1), a;
	for (int i = 0;i < N;i++) {
		l = P[i].first;
		auto it = upper_bound(all(P), make_pair(l + 1, 0));
		if (it == P.end())r = 0;
		else r = (*it).second;
		a = max(rm - max(ril, l) + 1, 0) + max(min(lir, r) - lm + 1, 0);
		ans = max(ans, a);
	}
	cout << ans << endl;
}

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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int main() {
  ll n, a[100001] = {}, ans = 0;
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  rep(i, 0, n) {
    int b = a[i] % 2;
    ans += a[i] / 2;
    if(b && a[i + 1]) a[i + 1]--, ans += 1;
  }

  cout << ans << endl;
}


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

typedef long long ll;

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

    int a,b;
    cin >> a >> b;
    double da = (double)a;
    double db = (double)b;
    printf("%d %d %.6lf\n",a/b,a%b,da/db);
    return 0;
}


Measured memory_bytes: 3180
#include <cstdio>
#include <algorithm>
#include <vector>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<int> T(N);
  for (size_t i = 1; i < N; ++i) {
    int C, S, F;
    scanf("%d %d %d", &C, &S, &F);
    for (size_t j = 0; j < i; ++j) {
      T[j] = std::max(S, (T[j]+F-1)/F*F) + C;
    }
  }

  for (auto ti: T) printf("%d\n", ti);
}

Measured memory_bytes: 256