akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void)
{
        int c1, c5, c10, c50, c100, c500;
        int a, b, c, d, e, f, x;
        scanf("%d %d %d %d %d %d",&c1, &c5, &c10, &c50, &c100, &c500);
        a=1*c1;
        b=5*c5;
        c=10*c10;
        d=50*c50;
        e=100*c100;
        f=500*c500;
        x=a+b+c+d+e+f;
        if(x>=1000)
                printf("%d\n",1);
        else
                printf("%d\n",0);
        return 0;
}

Measured memory_bytes: 1836
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n := io.NextInt()
	d1, d2 := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		d1[i], d2[i] = io.NextInt(), io.NextInt()
	}
	cnt := 0
	for i := 0; i < n; i++ {
		if d1[i] == d2[i] {
			cnt++
			if cnt == 3 {
				io.Println("Yes")
				return
			}
		} else {
			cnt = 0
		}
	}
	io.Println("No")
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    // 最悪計算量が O(HW(H + W))
    // 先に(i,j)で左右上下を向いた時の値を計算してメモすると，O(HW) * O(1)に落ちる
    int H, W;
    cin >> H >> W;
    bool board[H][W];
    rep(i, H){
        string S;
        cin >> S;
        rep(j, W){
            if (S[j] == '#'){board[i][j] = false;} else {board[i][j] = true;}
        }
    }

    int l2r[H][W], r2l[H][W], t2b[H][W], b2t[H][W];
    rep(i, H){
        int tmp = 0;
        rep(j, W){
            if (j == 0){l2r[i][0] = 0;} else {l2r[i][j] = tmp;}
            if (board[i][j]){tmp += 1;} else {tmp = 0; l2r[i][j] = 0;}
        }
    }
    rep(i, H){
        int tmp = 0;
        rrep(j, W-1, 0){
            if (j == W-1){r2l[i][W-1] = 0;} else {r2l[i][j] = tmp;}
            if (board[i][j]){tmp += 1;} else {tmp = 0; r2l[i][j] = 0;}
        }
    }

    rep(j, W){
        int tmp = 0;
        rep(i, H){
            if (i == 0){t2b[0][j] = 0;} else {t2b[i][j] = tmp;}
            if (board[i][j]){tmp += 1;} else {tmp = 0; t2b[i][j] = 0;}
        }
    }

    rep(j, W){
        int tmp = 0;
        rrep(i, H-1, 0){
            if (i == H-1){b2t[H-1][j] = 0;} else {b2t[i][j] = tmp;}
            if (board[i][j]){tmp += 1;} else {tmp = 0; b2t[i][j] = 0;}
        }
    }

    // rep(i, H){rep(j, W){cout << b2t[i][j] << " ";} cout << endl;}
    // rep(i, H){rep(j, W){cout << t2b[i][j] << " ";} cout << endl;}
    int ans = 0;
    rep(i, H){rep(j, W){
        if (board[i][j]){
            int tmp = l2r[i][j] + r2l[i][j] + t2b[i][j] + b2t[i][j] + 1;
            if (tmp > ans){ans = tmp;}
        }
    }}
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define ll long long
#define MOD 1000000007
#define FASTREAD ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main() {
    char arr[3];
    int countx=0;
    for(int i=0; i<3; i++) {
        cin >> arr[i];
        if(arr[i]=='1') countx++;
    }
    cout << countx << endl;
}


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

//整数转换成二进制串
char* itobs(int n,char *ps){
    int i;
    int size = 8 * sizeof(int);
    for(i=size-1;i>=0;i--,n >>=1)
        ps[i]=(1&n) + '0'; //如果前面是1，‘0’+1变‘1’，前面是0，‘0’+0变‘0’
    return ps;
}

void rev_bstr(char *ori_str, char *op_str){
    for(int i =0;i<32;++i){
        if(ori_str[i]=='0') op_str[i] = '1';
        else op_str[i] = '0';
    }
}

void right_bstr(char *ori_str, char *op_str){
    for(int i =1;i<32;++i){
        op_str[i] = ori_str[i-1];
    }
    op_str[0] = '0';
}

void left_bstr(char *ori_str, char *op_str){
    for(int i =0;i<31;++i){
        op_str[i] = ori_str[i+1];
    }
    op_str[31] = '0';
}

void show_bstr(char *str){
    for(int i =0;i<32;++i){
        putchar(str[i]);
    }
}

int main(void){
    char bin_str[8*sizeof(int)];
    char bin_op[8*sizeof(int)];
    int number;
    scanf("%d",&number);
    itobs(number,bin_str);
    show_bstr(bin_str);
    printf("\n");
    rev_bstr(bin_str,bin_op);
    show_bstr(bin_op);
    printf("\n");
    left_bstr(bin_str,bin_op);
    show_bstr(bin_op);
    printf("\n");
    right_bstr(bin_str,bin_op);
    show_bstr(bin_op);
    printf("\n");
    return 0;
}




Measured memory_bytes: 3160
#include <stdio.h>
int main(void){
    // Your code here!
    int N;
    scanf("%d",&N);
    int i,li[N],sum,big=0;
    for(i=0;i<N;i++){
        scanf("%d",&li[i]);
        if (big<li[i]){
            sum+=big;
            big=li[i];
        }
        else{
            sum+=li[i];
        }
    }
    
    //printf("%d,%d,%d\n",sum,N,big);
    (sum>big) ? puts("Yes"):puts("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<lu> vu;
typedef vector<v> vv;
typedef vector<vu> vvu;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
typedef pair<lu, lu> puu;
typedef vector<puu> vpuu;
const ll MOD = 1000000007;
const ld PI = 2 * acos(0.0);
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
  if (y > x) x = y;
#define amin(x, y) \
  if (y < x) x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yesno(f) \
  if (f) yes else no;
#define noo \
  { no return; }

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template <typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
  vector<T> a = vector<T>(n + oneIndexed);

  for (ll i = 0; i < n; i++) {
    T p;
    cin >> p;
    a[i + oneIndexed] = p;
  }

  return move(a);
}

template <typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
  if (end == -1) end = sz(a) - 1;
  for (ll i = begin; i <= end; i++) {
    // printf("%lu ", a[i]);
    cout << a[i] << " ";
  }
  cout << endl;
}

template <typename T, typename A>
void papair(vector<T, A> const &a, ll begin = 0, ll end = -1) {
  if (end == -1) end = sz(a) - 1;
  for (ll i = begin; i <= end; i++) {
    // printf("%lu ", a[i]);
    cout << a[i].first << " " << a[i].second << endl;
  }
}

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

  vv adjList(n + 1, v(0));
  v outdeg(n + 1, 0);
  v dp(n + 1, 0);
  for (ll i = 0; i < m; i++) {
    ll a, b;
    cin >> a >> b;
    adjList[b].push_back(a);
    // adjList[b].push_back(a);
    outdeg[a]++;
  }
  queue<ll> degrees;
  for (ll i = 1; i <= n; i++)
    if (!outdeg[i]) degrees.push(i);
  //   v toposort = {};
  while (!degrees.empty()) {
    auto node = degrees.front();
    degrees.pop();
    // toposort.push_back(node);
    for (auto neigh : adjList[node]) {
      outdeg[neigh]--;
      if (!outdeg[neigh]) degrees.push(neigh);
      amax(dp[neigh], 1 + dp[node]);
      //   cout << neigh << '\n';
    }
    // cout << node << " " << dp[node] << '\n';
  }
  ll ma = 0;
  for (ll i = 1; i < n + 1; i++) {
    amax(ma, dp[i]);
  }
  cout << ma << '\n';
}

int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  // ll t;cin >> t;while(t--)
  solve();
  return 0;
}

Measured memory_bytes: 7296
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	fmt.Println((intScanner() + intScanner() + 1) / 2)
}


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

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) の絶対値

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//配列の受け取り

main(){
  int n=in(),m=in(),s=0;
  vector<int> x(m),h(m-1);
  for (int i=0;i<m;i++) cin >> x[i];
  if (n>=m) {
    cout << '0' << endl;
    return 0;
  }
  sort(x.begin(),x.end());
  for (int i=0;i<m-1;i++) h[i]=x[i+1]-x[i];
  sort(h.begin(),h.end());
  for (int i=0;i<m-n;i++) s+=h[i];
  cout << s << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), inv(n + 1);
  REP(i, n) {
    cin >> a[i];
    inv[a[i]] = i + 1;
  }
  multiset<ll> st;
  REP(_, 2) {
    st.insert(0);
    st.insert(n + 1);
  }
  ll ans = 0;
  IFOR(x, 1, n + 1) {
    ll c = inv[x];
    st.insert(c);
    auto it = st.lower_bound(c);
    ll u1 = *(++it);
    ll u2 = *(++it);
    it--;
    it--;
    ll l1 = *(--it);
    ll l2 = *(--it);

    ll d = (u1 - c) * (l1 - l2) + (u2 - u1) * (c - l1);

    ans += x * d;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tlll tuple<ll, ll, ll>

ll inf = 1e9+7;

ll pw(ll x, ll y) {
    if (y == 0) return 1;
    else if (y == 1) return x % inf;
    else if (y % 2 == 0) {
        ll p = pw(x, y / 2);
        return p * p % inf;
    }
    else {
        ll p = pw(x, y / 2);
        return p * p % inf * x % inf;
    }
}

ll dv(ll x, ll y) {
    return x * pw(y, inf - 2) % inf;
}

int main() {
    ll n, c[200020];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(c, c + n);

    ll a0 = 0, d = 0, comb = 1;
    for (int i = 0; i <= n - 1; i++) {
        a0 += comb * (i + 1) % inf;
        a0 %= inf;
        d += comb * dv(i, n - 1) % inf;
        d %= inf;
        comb = comb * (n - 1 - i) % inf;
        comb = comb * dv(1, i + 1) % inf;

        //cout << a0 << " " << d << " " << comb << endl;
    }


    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans = ans + (a0 - i * d % inf) * c[i] % inf;
        ans %= inf;
        //cout << a0 - i * d << endl;
    }
    cout << (pw(2, n) * ans % inf + inf) % inf << endl;


}



Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()


queue<int> q;


void bfs(vector<int>& visited, vector<int>& c,   vector<vector<int> >& tree, int n){
  int k=0;
  int i;
  while(q.empty()!=1){
    i=q.front();
    visited[i]=c[n-1-k];
    q.pop();
    k++;
    REP(j, tree[i].size()){
      if(visited[tree[i][j]]==-1)q.push(tree[i][j]);
    }
  }
}



int main () {
  IN(n);
  int a, b;
  vector<vector<int> > tree(n);
  REP(i,n-1){
    cin >> a >> b;
    tree[a-1].push_back(b-1);
    tree[b-1].push_back(a-1);
  }
  vector<int> c(n);

  REP(i,n){
    cin>>c[i];
  }
  sort(ALL(c));
  cout << accumulate(c.begin(), c.end()-1, 0) << '\n';
  q.push(0);

  vector<int> visited(n,-1);
  bfs(visited, c, tree,n);
  REP(i,n){
    cout<<visited[i]<<" ";
  }
    
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

vector<int> G[100'010];
int maxdeg = 0;
map<pair<int, int>, int> color;
void dfs(int v, int p){
  //bool used[k] = {};
  int ban_c =  color[make_pair(p,v)];
  int now = 1;
  for(int nv:G[v]){
    if(nv == p){
      //used[color[make_pair(p,v)] - 1] = true;
      continue;
    }else{
      if(now == ban_c){
        now++;
      }
      color[make_pair(nv,v)] = color[make_pair(v,nv)] = now;
      now++;
      dfs(nv, v);//ちょっと微妙
    }
  }
  return;
}

int main(){
  
  int n;
  cin>>n;
  int a[n-1],b[n-1];
  REP(i,n-1){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  REP(i,n){
    maxdeg = max(maxdeg, (int)G[i].size());
  }
  dfs(0, -1);
  cout<<maxdeg<<endl;
  REP(i,n-1){
    int c = color[make_pair(a[i],b[i])];
    cout<<c<<endl;
  }
  return 0; 
}


Measured memory_bytes: 21376
import scala.annotation.tailrec
object Main extends App {
  import scala.io.StdIn._
  for (_ ← 0 until readInt()) {
    println(winner(readLine.trim.toList.map(_.asDigit), 0))
  }
  @tailrec def winner(digits: List[Int], count: Int): String = {
    digits match {
      case _::Nil ⇒ if (count % 2 == 0) "Audrey wins." else "Fabre wins."
      case a::b::t if a + b >= 10 ⇒ winner(1::(a + b) % 10 :: t, count + 1)
      case a::b::t ⇒ winner(a + b ::t, count + 1)
      case Nil ⇒ ???
    }
  }
}


Measured memory_bytes: 47004
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int min_num = -1;
  for (int i = 0; i < N; ++i){
    int A;
    cin >> A;
    
    int num = 0;
    bool even = true;
    while(even){
      even = (0 == (A % 2));
      if (even){
        num++;
        A /= 2;
      }
    }
    if (num < min_num || min_num < 0){
      min_num = num;
      if (0 == min_num){
        break;
      }
    }
  }
  cout << min_num << endl;
}

Measured memory_bytes: 256
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            temp = A[i]
            A[i] = A[j]
            A[j] = temp
    temp = A[i+1]
    A[i+1] = A[r]
    A[r] = temp
    return i




if __name__ == '__main__':
    # ??????????????\???
    # A = [13, 19, 9, 5, 12, 8, 7, 4, 21, 2, 6, 11]
    num_of_data = int(input())
    A = [int(x) for x in input().split(' ')]

    # ???????????????
    p = partition(A, 0, len(A)-1)

    # ???????????¨???
    left = A[:p+1]
    partition = A[p+1]
    right = A[p+2:]
    print('{0} [{1}] {2}'.format(' '.join(map(str, left)), partition, ' '.join(map(str, right))))

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

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    int iter = b / k + 1;
    int start = a / k -1;
    string ans = "NG";
    for(int i=start; i<iter; i++)
        if(a <= k*i && k*i <= b)
            ans = "OK";

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

Measured memory_bytes: 3596
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String str = in.next();
        boolean x =false;

        for(int i = 0 ; i<str.length() ; i++)
        {


            if(str.charAt(i)=='7')
            {
                x = true;
            }

        }

            if(x == true)
            {
                System.out.println("Yes");
            }
            else
                {
                    System.out.println("No");
                }




 }

    }


    







Measured memory_bytes: 35332
def replace(a):
    if a == "0":
        a = "1"
    else:
        a = "0"
    return a

n = str(input())
l = [str(x) for x in list(str(n))]

count = 0
for i in range(1,len(l)):
    if l[i] == l[i-1]:
        l[i] = replace(l[i])
        count += 1
        
print(count)

Measured memory_bytes: 4724
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var a = input[1].split(" ").map(i => parseInt(i));
  var ans = 0;
  var dp = new Array(N);
  var sum = new Array(N);
  sum[0]=a[0];
  for(var i=0;i<N;i++){
    var tmp=new Array(N).fill(0);
    dp[i]=tmp;
    if(i>0){
      sum[i]=sum[i-1]+a[i];
    }
  }
  for(var k=1;k<N;k++){
    for(var i=0,j=k;i<N&&j<N;i++,j++){
      var tmp=Math.pow(10,19);
      for(var l=i;l<j;l++){
        if(i!=0){
          tmp=Math.min(tmp,dp[i][l]+dp[l+1][j]+sum[j]-sum[i-1]);
        }else{
          tmp=Math.min(tmp,dp[i][l]+dp[l+1][j]+sum[j]);
        }
      }
      dp[i][j]=tmp;
    }
  }
  var ans=dp[0][N-1];

  console.log('%s', ans);
  return ans;
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 14896
#include<stdio.h>

int map[10][10],count;
int x,y,N=10;

int main(){
  while(scanf("%d",&N)*N){
  for(x=0;x<10;x++){
    for(y=0;y<10;y++){
      map[x][y]=x?map[x-1][y+1]+1:y?map[x][y-1]+y:1;
    }
  }
  printf("Case %d:\n",++count);
  for(x=0;x<N;x++){
    for(y=0;y<N;y++){
      if(x+y<N){
        if((x+y)%2){
          printf("%3d",map[x][y]);
        }
        else{
          printf("%3d",map[y][x]);
        }
      }
      else{
        if((x+y)%2){
          printf("%3d",N*N-map[N-1-x][N-1-y]+1);
        }
        else{
          printf("%3d",N*N-map[N-1-y][N-1-x]+1);
        }
      }
    }
    printf("\n");
  }
  }
}

Measured memory_bytes: 616
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}


Measured memory_bytes: 2464
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
ll high_order_bit(ll n){
    ll tmp=1,i=-1;
    while(tmp<=n){
        tmp*=2;
        i++;
    }
    if(n==0) return 0;
    else return i;
}
vector<ll> binary_expansion(ll n){
    vector<ll> B(high_order_bit(n)+1);
    ll tmp=n;
    for(ll i=high_order_bit(n);i>=0;i--){
        B[i]=tmp/pw2[i];
        tmp%=pw2[i];
    }
    return B;
}
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll H,W,K; cin>>H>>W>>K;
    ll ans=0;
    vector<vector<ll> > field(H,vector<ll>(W,0));
    rep(i,H){
        string s; cin>>s;
        rep(j,W) {
            if(s[j]=='#'){
                field[i][j]=1;
            }
        }
    }
    rep(i,pw2[H])rep(j,pw2[W]){
        vector<ll> H_0(H);
        vector<ll> W_0(W);
        ll tmps=i;
        rrep(i2,H){
            H_0[H-1-i2]=tmps/pw2[i2];
            tmps%=pw2[i2];
        }
        tmps=j;
        rrep(j2,W){
            W_0[W-1-j2]=tmps/pw2[j2];
            tmps%=pw2[j2];
        }
        //rep(k,sz(W_0)) cout<<W_0[k];
        //cout<<endl;
        ll tmp=0;
        rep(i2,H)rep(j2,W){
            if((H_0[i2]==0)&&(W_0[j2]==0)&&(field[i2][j2]==1)) tmp++;
        }
        if(tmp==K) ans++;
        //cout<<"i:"<<i<<" j:"<<j<<" "<<tmp<<endl;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3632
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B, C := getInt(), getInt(), getInt()

	x := A % B
	y := x
	for {
		if y == C {
			out("YES")
			return
		}
		y = (y + x) % B
		if y == x {
			out("NO")
			return
		}
	}

}


Measured memory_bytes: 640
#include <string>
#include <iostream>
using namespace std;
int main(){
    string W,T;
    int count=0;
    getline(cin,W);
    cin>>T;
    while(T!="END_OF_TEXT"){
        for(int i=0;i<(int)T.size();i++){
            if(T[i]>='A'&&T[i]<='Z')T[i]+='a'-'A';
        }
        for(int i=0;i<(int)T.size();i++){
            for(int j=0;j<(int)W.size();j++){
                if(T[j+i]!=W[j])break;
                if(j==(int)W.size()-1&&(int)T.size()==(int)W.size())count++;
            }
        }
        cin>>T;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3112
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B;

int main() {
	scanf("%lld %lld", &A, &B);
	ll ans = (A * B) / __gcd(A, B);
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Measured memory_bytes: 3064
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
ab = list(map(int,read().split()))

links = [[] for _ in range(n+1)]
it = iter(ab)
for a,b in zip(it,it):
    links[a].append(b)
    links[b].append(a)

def bfs(root):
    depth = [-1] * (n+1)
    depth[root] = 0
    stack = [root]
    for i in range(1,n+1):
        next = []
        if(len(stack)==0):
            break
        while(stack):
            parent = stack.pop()
            for j in links[parent]:
                if(depth[j] == -1):
                    depth[j] = i
                    next.append(j)
        stack = next[::]

    return depth,parent

depth,root2 = bfs(1)
depth,root2 = bfs(root2)
r = max(depth)

if(r%3==1):
    print('Second')
else:
    print('First')

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  ll a[n + 1];
  REP1(i, n) cin >> a[i];
  vector<ll> left(n + 2), right(n + 2);
  left[1] = a[1];
  for (int i = 2; i <= n; ++i) {
    left[i] = left[i - 1] + a[i];
  }
  right[n] = a[n];
  for (int i = n - 1; i >= 1; --i) {
    right[i] = right[i + 1] + a[i];
  }
  ll ans = 1e10;
  for (int i = 1; i <= n - 1; ++i) {
    ans = min(ans, abs(left[i] - right[i + 1]));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
char s[300002];
int f1[300002],f2[300002],g1[300002],g2[300002];
int main(){
	int n,t,ans=0x3f3f3f3f;
	scanf("%d%s",&n,s);
	for(int i=0;s[i];i++)f1[i]=f1[i-1]+(s[i]=='W');
	for(int i=0;s[i];i++)g1[i]=g1[i-1]+(s[i]=='E');
	for(int i=n-1;i>=0;i--)f2[i]=f2[i+1]+(s[i]=='W');
	for(int i=n-1;i>=0;i--)g2[i]=g2[i+1]+(s[i]=='E');
	ans=min(f2[0],g2[0]);
	for(int i=0;s[i];i++)ans=min(ans,f1[i]+g2[i+1]);
	printf("%d",ans);
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

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

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

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(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

struct UnionFind{
	vi rank,par;
	void Init(int n){
		rank.assign(n,0);
		par.assign(n,-1);
	}
	int Find(int i){
		return par[i]==-1?i:(par[i]=Find(par[i]));
	}
	bool Same(int a,int b){
		return Find(a)==Find(b);
	}
	bool Unite(int a,int b){
		a=Find(a);
		b=Find(b);
		if(a==b)
			return false;
		if(rank[a]<rank[b])
			swap(a,b);
		par[b]=a;
		if(rank[a]==rank[b])
			rank[a]++;
		return true;
	}
};

signed main(){
	int n=read(),k=read(),l=read();
	UnionFind uf1,uf2;
	uf1.Init(n);
	uf2.Init(n);
	REP(i,k){
		int x=read()-1,y=read()-1;
		uf1.Unite(x,y);
	}
	REP(i,l){
		int x=read()-1,y=read()-1;
		uf2.Unite(x,y);
	}
	vector<vi> idx(n);
	REP(i,n)
		idx[uf1.Find(i)].PB(i);
	vi ans(n,0),cmp(n,0);
	for(auto w:idx){
		for(auto v:w)
			cmp[uf2.Find(v)]++;
		for(auto v:w)
			ans[v]=cmp[uf2.Find(v)];
		for(auto v:w)
			cmp[uf2.Find(v)]=0;
	}
	REP(i,n)
		print(ans[i],i==n-1?1:2);
}


Measured memory_bytes: 19968
s = input()
if 0 < int(s[:2]) < 13:
    if 0 < int(s[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0 < int(s[2:]) < 13:
    if 0 < int(s[:2]) < 13:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] nums = new int[3];
    for (int i = 0; i < 3; i++) {
      nums[i] = sc.nextInt();
    }
    Arrays.sort(nums);
    int deltaMax = nums[2] - nums[0];
    int deltaMin = nums[2] - nums[1];
    if ((deltaMax % 2 == 0 && deltaMin % 2 == 0) 
                                                  || (deltaMax % 2 == 1 && deltaMin % 2 == 1) ) {
      System.out.println((deltaMax + deltaMin) / 2);
    } else {
      System.out.println((deltaMax + deltaMin) / 2 + 2);
    }
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int *a = (int *)calloc(31, sizeof(int)), tmp;
	
	while(cin >> tmp){
		a[tmp]++;
	}
	
	for(int i = 1,f = 0; i <= 30; i++){
		if(a[i] != 1){
			cout << i << endl;
			f++;
			if(f == 2){
				break;
			}
		}
	}
	
	free(a);
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int block;
const int maxN = 5e5+5;
int vis[maxN];
bool cmp(pair<int,pii>& a,pair<int,pii>& b)
{
    if(a.s.f/block==b.s.f/block)
        return a.s.s<b.s.s;
    return a.s.f/block<b.s.f/block;
}
int main()
{
    int n,q;
    cin>>n>>q;
    int a[n];
    rep(i,0,n)
    cin>>a[i];
    block = sqrt(n);
    pair<int,pii> p[q];
    rep(i,0,q)
    {
        int l,r;
        cin>>l>>r;
        l--;
        r--;
        p[i].f=i;
        p[i].s.f=l;
        p[i].s.s=r;
    }
    sort(p,p+q,cmp);
    int answer=0;
    int curl=0,curr=0;
    fill(vis,0);
    int res[q];
    rep(i,0,q)
    {
        int pos=p[i].f;
        int l=p[i].s.f;
        int r=p[i].s.s;
        while(curl<l)
        {
            vis[a[curl]]--;
            if(vis[a[curl]]==0)
                answer--;
            curl++;
        }
        while(curl>l)
        {
            vis[a[curl-1]]++;
            if(vis[a[curl-1]]==1)
                answer++;
            curl--;
        }
        while(curr<=r)
        {
            vis[a[curr]]++;
            if(vis[a[curr]]==1)
                answer++;
            curr++;
        }
        while(curr > r+1)
        {
            vis[a[curr-1]]--;
            if(vis[a[curr-1]]==0)
                answer--;
            curr--;

        }
        res[pos]=answer;

    }
    rep(i,0,q)
    cout<<res[i]<<endl;
}

Measured memory_bytes: 15440
#include<stdio.h>
int main(void)
{
	int a=0,b,i;
	for(i=0;i<5;i++){
		scanf("%d",&b);
		if(b<40) b=40;
		a=a+b;
	}
	a=a/5;
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 2684
<?php
$N = intval(trim(fgets(STDIN)));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$B = array_map("intval", explode(" ", trim(fgets(STDIN))));
$dp = array_fill(0, 1<<$N, array_fill(0,51,PHP_INT_MAX));
$dp[0][0] = 0;
for($bit = 0, $NN = 1<<$N; $bit < $NN; ++$bit){
    $con = 0;
    $x = $bit;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
     
    $ords = [];
    $iter = $con - 1;
    for($i = 0; $i < $N; ++$i)
        if(!($bit & (1<<$i)))
            $ords[$i] = ++$iter;
    for($s = 0; $s <= 50; ++$s){
        if($dp[$bit][$s] == PHP_INT_MAX)continue;
        foreach($ords as $p0 => $p1){
            $ns = ($p0-$con) & 1 ? $B[$p0] : $A[$p0];
            if($ns >= $s){
                $target = &$dp[$bit | (1<<$p0)][$ns]; 
                $target = min($target, $dp[$bit][$s] + abs($p1 - $con));
            }
        }
    }
}
$min = min($dp[(1<<$N)-1]);
if($min == PHP_INT_MAX){
    echo -1;
}else{
    echo $min;
}


Measured memory_bytes: 690680
#include<iostream>
using namespace std;
int main(){
	int a[100][100];
	int r, c, b;
	int Wsum=0, Hsum=0, Asum=0;
	cin >> r >> c;
		for(int i=0; i<100; i++){
			for(int j=0; j<100; j++){
				a[i][j]=0;
			}
		}
		for(int i=0; i<r; i++){
			for(int j=0; j<c; j++){
				cin >> b;
				a[i][j]=b;
				cout << a[i][j] << " ";
				Wsum += a[i][j];
			}
			cout << Wsum << endl;
			Asum +=  Wsum;
			Wsum = 0;
		}
		for(int i=0; i<c; i++){
			for(int j=0; j<r; j++){
				Hsum += a[j][i];
			}
			cout << Hsum << " ";
			Hsum = 0;
		}
		cout << Asum << endl;
}



Measured memory_bytes: 3128
S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    exit(0)

if S[0] != S[-1]:
    f = 0
    t = 0
    ans = 0
    for k in range(1,len(S)):
        if S[k-1] == S[k] and f == 0:
            f = 1
            t = 2
        elif S[k-1] == S[k] and f == 1:
            t += 1
        else:
            ans += t//2
            t = 0
            f = 0
    ans += t//2
    print(ans*K)
else:
    t = set([str(x) for x in S])
    if len(t) == 1:
        print((len(S)*K)//2)
    else:
        mae = 0
        ushiro = 0
        for k in range(len(S)):
            if S[k] == S[0]:
                mae += 1
            else:
                break
        for k in range(len(S)):
            if S[-k-1] == S[0]:
                ushiro += 1
            else:
                break
        f = 0
        t = 0
        ans = 0
        for k in range(mae,len(S)-ushiro):
            if S[k-1] == S[k] and f == 0:
                f = 1
                t = 2
            elif S[k-1] == S[k] and f == 1:
                t += 1
            else:
                ans += t//2
                t = 0
                f = 0
        ans += t//2
        print(ans*K + mae//2 + ushiro//2 + (K-1)*((mae+ushiro)//2))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    double n,d;
    cin>>n>>d;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        double x,y;
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
//typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(true){
    c -= b;
    if(c<=0){
      cout<<"Yes"<<endl;
      break;
    }
    a -= d;
    if(a<=0){
      cout<<"No"<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll X[100011];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,p;
	cin>>n>>p;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		ll w,b; cin>>w>>b;
		sum+=-ll(p)*b;
		X[i]=ll(p)*b+ll(100-p)*w;
	}
	sort(X,X+n);
	reverse(X,X+n);
	for(int i=0;i<n;i++)
	{
		sum+=X[i];
		if(sum>=0)
		{
			cout<<i+1<<'\n';
			return 0;
		}
	}
}	


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
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; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
const ll INF =1LL << 62;

int main(){
  int N;
  cin >> N;
  ll h[100010] ;
  cinf(N,h);
  ll dp[100010];
  rep(i,N) dp[i] = INF;
  
  dp[0] =0;
  for(int i=1;i<N;i++){
    chmin(dp[i],dp[i-1] +abs(h[i] - h[i-1])) ;
    if(i>1)
      chmin(dp[i],dp[i-2] +abs(h[i] - h[i-2]));
  }
  cout << dp[N-1] << endl;
}

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

long long K[101][100001];
int values[101];
int weights[101];

long long knapSack(int W, int wt[], int val[], int n)
{
	int i, w;


	for (i = 0; i <= n; i++)
	{
		for (w = 0; w <= W; w++)
		{
			if (i == 0 || w == 0)
				K[i][w] = 0;
			else if (wt[i - 1] <= w)
				K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i - 1][w]);
			else
				K[i][w] = K[i - 1][w];
		}
	}

	return K[n][W];
}


int main()
{
	int n, w;
	cin >> n >> w;
	for (int i = 0; i < n; i++)
	{
		cin >> weights[i] >> values[i];
	}

	cout << knapSack(w, weights, values, n) << endl;
	system("pause");
}


Measured memory_bytes: 79352
#include <cctype>
#include <iostream>
#include <string>
#include <complex>
using namespace std;
typedef string::iterator S;
complex<int> explession(S& it);

bool overflow;

complex<int> number(S& it) {
	if (*it == 'i') {
		++it;
		return complex<int>(0, 1);
	}
	int n = 0;
	while (isdigit(*it)) {
		n *= 10;
		n += (*it) - '0';
		overflow = overflow || (abs(n) > 10000);
		++it;
	}
	if (*it == 'i') {
		++it;
		return complex<int>(0, n);
	}
	else {
		return complex<int>(n, 0);
	}
}

complex<int> factor(S& it) {
	if (*it == '(') {
		++it;
		complex<int> result = explession(it);
		++it;
// 		cout << result << endl;
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
		return result;
	}
	else {
		complex<int> result = number(it);
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
		return result;
	}
}

complex<int> term(S& it) {
	complex<int> result = factor(it);
	while (*it == '*') {
		++it;
		complex<int> x = factor(it);
		result *= x;
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
	}
// 	cout << result << endl;
	return result;
}

complex<int> explession(S& it) {
	complex<int> result = term(it);
	while (*it == '+' || *it == '-') {
		char op = *it++;
		complex<int> x = term(it);
		if (op == '+') {
			result += x;
		}
		if (op == '-') {
			result -= x;
		}
		overflow = overflow || (abs(result.real()) > 10000);
		overflow = overflow || (abs(result.imag()) > 10000);
	}
// 	cout << result << endl;
	return result;
}

int main() {
	string str;
	while (cin >> str) {
		string::iterator it = str.begin();
		overflow = false;
		complex<int> c = explession(it);
		if (overflow) {
			cout << "overflow" << endl;
		}
		else if (c == complex<int>(0, 0)) {
			cout << 0 << endl;
		}
		else {
			if (c.real() != 0) {
				cout << c.real();
				if (c.imag() > 0) {
					cout << '+';
				}
			}
			if (c.imag() != 0) {
				cout << c.imag();
				cout << 'i';
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define PI 3.141592
typedef long long ll;
using namespace std;
int main()
{
	ll N, cnt = 0; cin >> N;
  	vector<ll> L(N);
  	for (int i = 0; i < N; i++) {
    	cin >> L[i];
    }
  	vsort(L);
  	for (int i = 0; i < N - 2; i++) {
    	for (int j = i + 1; j < N - 1; j++) {
        	ll limit = L[i] + L[j];
          	for (int k = j + 1; k < N; k++) {
            	if (L[k] < limit) {
                	cnt++;
                } else {
                	break;
                }
            }
        }
    }
  	cout << cnt << endl;
}

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

using namespace std;

typedef long long int ll;

int main(void) {
    string buf;
    cin >> buf;
    int n = atoi(buf.c_str());
    int s = 0;
    for(int i = 0;i < buf.length();i++) {
        char temp[2] = {};
        temp[0] = buf[i];
        s = s + atoi(temp);
    }
    if(n % s == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 888
# 横か縦か。各時点でn-2 or n-1C2
# str1だけ見ればよい

N = int(input())
txt = input()

pattern = []
j = 0

while j < N:
  if j == N-1 or txt[j] != txt[j+1]:
    pattern.append(1)
    j += 1
  else:
    pattern.append(2)
    j += 2


    
MOD = 10**9 + 7

ans = 3 if pattern[0] == 1 else 6
for j in range(1,len(pattern)):
  a,b = pattern[j-1:j+1]
  if (a,b) == (1,1):
    ans *= 2
  elif (a,b) == (1,2):
    ans *= 2
  elif (a,b) == (2,1):
    ans *= 1
  else:
    ans *= 3
  ans %= MOD

print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int LIM = 10000001;
char h[LIM];
int sh[LIM];

bool solve() {
    int m, n;
    cin >> m;
    if (m == 0) { return false; }
    cin >> n;
    cout << (sh[n] - sh[m-1]) << endl;
    return true;
}

int main() {
    fill(h, h+LIM, 0);
    h[1] = 1;
    for (int j = 2; j < LIM; ++j) {
        if (j % 2 == 0) { h[j] |= h[j/2]; }
        if (j % 3 == 0) { h[j] |= h[j/3]; }
        if (j % 5 == 0) { h[j] |= h[j/5]; }
    }
    sh[0] = 0;
    for (int j = 1; j < LIM; ++j) {
        sh[j] = sh[j-1] + h[j];
    }
    while(solve());
    return 0;
}

Measured memory_bytes: 51812
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>

using namespace std;

int simulate(int N, const vector<int>& X, int P)
{
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		ans += (X[i] - P) * (X[i] - P);
	}
	return ans;
}

int main()
{
	int N;
	cin >> N;
	vector<int> X(N);
	for (auto& X_i : X) {
		cin >> X_i;
	}

	int ans = numeric_limits<int>::max();

	for (int P = 1; P <= 100; ++P) {
		ans = min(ans, simulate(N, X, P));
	}

	cout << ans << endl;
}


Measured memory_bytes: 256