akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

LL A, B, P;

int dig(LL x){
  int res = 0;
  while(x > 0) x /= 10, ++res;
  return res;
}

LL f(LL x){
  int d = dig(x);
  LL res = 1;
  while(d>0) res *= 10, --d;
  return res;
}

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

  while(cin>>A>>B>>P,A){
	LL D = B - A;
	LL dp[100010][2];
	fill((LL*)dp, (LL*)dp+100010*2, 0);
	dp[D][0] = 1;
	dp[D][1] = 1;
	for(int i=D-1;i>=0;--i){
	  LL x = A + i;
	  dp[i][0] = 1;
	  if(dig(x) == dig(x+1))
		dp[i][0] = (dp[i][0] + dp[i+1][1]) % P;

	  for(LL tmp=x*10;tmp<=B;tmp*=10){
		dp[i][0] += dp[tmp-A][1];
		dp[i][0] %= P;
	  }
	  if(dig(x) == dig(x+1))
		dp[i][1] = (dp[i][0] + dp[i+1][1]) % P;
	  else
		dp[i][1] = dp[i][0];
	}
	LL ans = 0;
	REP(i,D+1) ans = (ans + dp[i][0]) % P;
	cout << ans << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 2748
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com

#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
typedef long long int LL;
typedef unsigned long long int ULL;
int main()
{
    fast;
    int i,j,k,n,m,l,s=0,y,tc=1,c=0;
    LL x=0;
    while(cin>>n>>m)
    {
        x=m;
        rep(i,n)
        {
            cin>>c;
            if(i>0)
            {
                y=abs(c-y);
                if(y>m) x+=m;
                else x+=y;
            }
            y=c;
        }
        cout<<x<<endl;
    }
}

Measured memory_bytes: 256
function main(lines) {
  const [K, X] = na();

  const ans = 500*K >= X ? 'Yes' : 'No';
  
  return ans;
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);

const ans = main(lines);
console.log( ans );

Measured memory_bytes: 29608
#include<stdio.h>
#include<iostream>
using namespace std;


int main()
{
    //freopen("in.txt", "r", stdin);

    char ch[20];

    scanf("%s", ch);

    for(int i=0;i<19;i++){
        if(ch[i] == ','){
            ch[i] = ' ';
        }
    }

    printf("%s\n", ch);




    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    	string s,t;
      	cin>>s;
      	cin>>t;
      	int n=s.length(),m=t.length();
      	int dp[n+1][m+1];
      	for(int i=0;i<=n;i++){
          	for(int j=0;j<=m;j++){
            	if(i==0||j==0){
                	dp[i][j]=0;
                }else if(s[i-1]==t[j-1]){
                	dp[i][j]=dp[i-1][j-1]+1;
                }else{
                	dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
                }
            }
        }
      	int index = dp[n][m]; 
       	char ans[index+1]; 
       	ans[index] = '\0';
        int i = n, j = m; 
        while (i > 0 && j > 0) 
        { 
            if (s[i-1] == t[j-1]) 
            { 
                ans[index-1] = s[i-1]; 
                i--; j--; index--;   
            }
            else if (dp[i-1][j] > dp[i][j-1]) 
               i--; 
            else
               j--; 
         } 
      	cout<<ans<<endl;
    }

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

int main(){
    ll a, b; cin >> a >> b;
    if (a > b){
        cout << "GREATER" << endl;
    } else if (a == b){
        cout << "EQUAL" << endl;
    } else {
        cout << "LESS" << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <utility>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#define ll long long
         
using namespace std;
     
long long gcd(int x, int y){
     if ( x == 0 ) return y;
     
     return gcd(y%x, x);
}
     
long long lcm(int x, int y){
     if ( y == 0 ){
          return x;
     }
     
     return x*y/gcd(x, y);
}
     
int min(int a, int b){
     return a > b ? b : a;
}
     
double max(double a, double b){
     return a > b ? a : b;
}

ll h;

ll solve(ll a){
     if ( a == 1 ){
          return 1;
     }

     return 1 + 2*solve(a/2);
}

int main()
{
     cin.sync_with_stdio( false );
     cin>>h;
     cout<<solve(h)<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(int argv, char **argc){
    cin.tie(0); ios::sync_with_stdio(0);

    int n, a[50], b[50], cnt = 0;
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a, a + n);
    for(int i = 0; i < n;  ++i){
        cnt += (a[i] != b[i]);
    }
    printf("%s\n", cnt <= 2 ? "YES" : "NO");
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <numeric>
using namespace std;
#define MAX_N 1000000000

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

// input
int A;
int B;

int main() {
  cin >> A >> B;

  int C[3];
  C[0] = A + B;
  C[1] = A - B;
  C[2] = A * B;
  chmax(C[0], C[1]);
  chmax(C[0], C[2]);

  cout << C[0] << endl;
}


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

#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;

using namespace std;

using ll = long long;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;

ll powmod(ll a, ll b) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


int main()
{
	FAST_IO;
	string s;
	int n;
	cin >> n;
	cin >> s;
	vector<int> r(n + 1); // 'R', 'G', 'B'
	vector<int> g(n + 1);
	vector<int> b(n + 1);
	for (int i = 0; i < n; ++i) {
		r[i + 1] = r[i];
		g[i + 1] = g[i];
		b[i + 1] = b[i];
		if (s[i] == 'R')
			++r[i + 1];
		else if (s[i] == 'G')
			++g[i + 1];
		else
			++b[i + 1];
	}
	ll ans = 0;
	for (int k = 0; k < n; ++k) {
		for (int j = 0; j < k; ++j) {
			int dist = k - j;
			if (s[k] == 'R') {
				if (s[j] == 'G') {
					ans += b[j];
					if (j - dist >= 0 && s[j - dist] == 'B')
						--ans;
				}
				else if (s[j] == 'B') {
					ans += g[j];
					if (j - dist >= 0 && s[j - dist] == 'G')
						--ans;
				}
			}
			else if (s[k] == 'G') {
				if (s[j] == 'R') {
					ans += b[j];
					if (j - dist >= 0 && s[j - dist] == 'B')
						--ans;
				}
				else if (s[j] == 'B') {
					ans += r[j];
					if (j - dist >= 0 && s[j - dist] == 'R')
						--ans;
				}
			}
			else { // 'B'
				if (s[j] == 'G') {
					ans += r[j];
					if (j - dist >= 0 && s[j - dist] == 'R')
						--ans;
				}
				else if (s[j] == 'R') {
					ans += g[j];
					if (j - dist >= 0 && s[j - dist] == 'G')
						--ans;
				}
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a) 
#define  fi first
#define  se second 
using namespace std;
using li = long long;
using ul = unsigned long long;
using vi = vector<li>;
using vs = vector<string>;
inline ul gcd(ul a,ul b) { return b?gcd(b,a%b):a; }
const int INF=1e9+9;


int main()
{
    int n,x,y;
    cin>>n;
    vector<pair<int,int>> a(n);
    rep(i,n) { cin>>x>>y; a.pb(make_pair(x,y)); }
    sort(all(a));
    reverse(all(a));
//    for(auto x:a)cout<<x.fi<<" "<<x.se<<endl;
    cout<<a[0].first+a[0].second<<endl;;

    
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {

    string s; cin >> s;
    char prev = s[0];
    for(int i = 1; i < s.size(); ++i) {
        if(prev == s[i]) {cout << "Bad"; return 0;}
        prev = s[i];
    }
    cout << "Good";
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
  {
     
     int a,b,x;
     scanf("%d%d%d",&a,&b,&x);
      if(a<=x && (a+b)>x)
           printf("YES");
  
     else
         printf("NO");
  
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, 0, n){
        cin >> a[i];
        sum += a[i];
    }
    int t = n * (n + 1) / 2;
    if(sum % t != 0){
        cout << "NO" << endl;
        return 0;
    }
    int c = sum / t;    
    int cnt = 0;
    bool f = true;
    rep(i, 0, n){
        int d = a[(i + 1) % n] - a[i];
        int r = (c - d) % n;
        int q = (c - d) / n;
        if(r == 0) cnt += q;
        if(r != 0 || q < 0 || c < q){
            f = false;
        }
    }
    if(cnt != c) f = false;
    cout << (f ? "YES" : "NO") << endl;
}

Measured memory_bytes: 1024
// import chie template :) {{{
import std.stdio,
       std.algorithm,
       std.array,
       std.string,
       std.math,
       std.conv,
       std.range,
       std.container,
       std.bigint,
       std.ascii;
// }}}
// tbh.scanner {{{
class Scanner {
  import std.stdio;
  import std.conv : to;
  import std.array : split;
  import std.string : chomp;

  private File file;
  private dchar[][] str;
  private uint idx;

  this(File file = stdin) {
    this.file = file;
    this.idx = 0;
  }

  private dchar[] next() {
    if (idx < str.length) {
      return str[idx++];
    }

    dchar[] s;
    while (s.length == 0) {
      s = file.readln.chomp.to!(dchar[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)() {
    return next.to!(T);
  }

  T[] nextArray(T)(uint len) {
    T[] ret = new T[len];

    foreach (ref c; ret) {
      c = next!(T);
    }

    return ret;
  }
}
// }}}

void main() {
  auto cin = new Scanner;
  int n = cin.next!int, y = cin.next!int;
  writeln(n * y % 2 == 0 ? "Even" : "Odd");
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int N,D1,D2,count=0,ans=0;
  cin >>N;
  
  for(int i=0; i<N;i++){
    cin >> D1 >> D2;
    if(D1 == D2){
      count++;
    }else{
      count=0;
    }
    if(count==3){
      ans=1;
    }
  }
  
  if(ans==1){
    cout <<"Yes";
  }else{
    cout << "No";
  }
}

Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

string N;
char C[210000];

int ctoi(const char c){
    switch(c){
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default : return -1;
    }
}

int main(void){

    cin >> N;
    ll NL = N.length();

    for (int i = 1; i <= NL; i++){
        C[i] = N[i-1]; //chは[0]から始まるので注意！
    }

    ll ans = 0;
    ll X = 0;

    for (int i = 1; i <= NL; i++){
        X = ctoi(C[i]);
        ans += X;
    }

    ans = ans % 9;

    if (ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3940
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO.Pipes;
using System.Linq;

class Program
{ 
	public static int Main()
	{
    Scanner cin = new Scanner();
	  int n = cin.nextInt();
    int[] cards = new int[2 * n];
	  for (int i = 0; i < 2 * n; i++)
	  {
	    cards[i] = i + 1;
	  }
	  int m = cin.nextInt();
	  while (m-- != 0)
	  {
	    int q = cin.nextInt();
	    if (q == 0)
	    {
	      int[] oneInts = new int[n];
	      int[] twoInts = new int[n];
	      Array.Copy(cards, 0, oneInts, 0, n);
	      Array.Copy(cards, n, twoInts, 0, n);
	      for (int i = 0; i < n; i++)
	      {
	        cards[2 * i] = oneInts[i];
	        cards[2 * i + 1] = twoInts[i];
	      }
	    }
	    else
	    {
        int[] oneInts = new int[q];
        int[] twoInts = new int[2 * n - q];
        Array.Copy(cards, 0, oneInts, 0, q);
        Array.Copy(cards, q, twoInts, 0, 2 * n - q);
	      for (int i = 0; i < 2 * n; i++)
	      {
	        if (i < 2 * n - q)
	        {
	          cards[i] = twoInts[i];
	        }
	        else
	        {
	          cards[i] = oneInts[i - 2 * n + q];
	        }
	      }
	    }
	  }
	  for (int i = 0; i < 2 * n; i++)
	  {
	    Console.WriteLine(cards[i]);
	  }
	  return 0;
	}

}

class Scanner {
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner() {
		s = new string[0];
		i = 0;
	}

	public string next() {
		if (i < s.Length) return s[i++];
		do {
			s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
		} while ((s.Length == 1 && s[0] == "") || s.Length == 0);
		i = 0;
		return s[i++];
	}

	public int nextInt() {
		return int.Parse(next());
	}

	public long nextLong() {
		return long.Parse(next());
	}

	public double nextDouble() {
		return double.Parse(next());
	}

}

Measured memory_bytes: 5788
package main

import (
	"fmt"
)

func main() {
	var a,b,c,x,cnt int
	fmt.Scan(&a,&b,&c,&x)
	
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500 * i + 100 * j + 50 * k == x {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 512
n=int(input())
mydict={}

for i in range(n):
  a=int(input())
  if a in mydict:
    if mydict[a]==1:
      mydict[a]=0
    else:
      mydict[a]=1
  else:
    mydict[a]=1
    
#print(mydict)
mylist=mydict.values()

print(sum(mylist))


Measured memory_bytes: 15068
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

def num_to_char(num)
  return "a" if num == 1
  return "b" if num == 2
  return "c" if num == 3
  return "d" if num == 4
  return "e" if num == 5
  return "f" if num == 6
  return "g" if num == 7
  return "h" if num == 8
  return "i" if num == 9
  return "j" if num == 10
  return "k" if num == 11
  return "l" if num == 12
  return "m" if num == 13
  return "n" if num == 14
  return "o" if num == 15
  return "p" if num == 16
  return "q" if num == 17
  return "r" if num == 18
  return "s" if num == 19
  return "t" if num == 20
  return "u" if num == 21
  return "v" if num == 22
  return "w" if num == 23
  return "x" if num == 24
  return "y" if num == 25
  return "z" if num == 0
end

n = input_n
str = ""

(1..99).each do |i|
  if n <= 26 ** i
    n -= 1
    i.times do |j|
      # str << num_to_char(n % 26)
      str << ("a".ord + n % 26).chr
      n = n / 26
    end
    break
  else
    n -= 26 ** i
  end
end

str = str.reverse

puts str


Measured memory_bytes: 14316
#include <stdio.h>

int mini(int a,int b){if(a<b){return a;}return b;}

int main(void){
  int n, x, i;
  scanf("%d%d", &n, &x);
  int a[n];
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  int min = a[0];
  for(i = 1; i < n; i++){
    min = mini(min, a[i]);
  }
  
  int ans = n;
  for(i = 0; i < n; i++){
    x -= a[i];
  }
  
  while(x >= min){
    ans++;
    x -= min;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 61;
const lli INF = 1e18;
const lli MOD = 13;
const double EPS=1e-4;

bool m[N];
vi primes(1,2);
void sieve(){
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

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

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7


int main(){_
	lli a,b,d;
	cin>>a>>b>>d;
	vl u(a),v(b);
	fore(i,0,a)cin>>u[i];
	fore(i,0,b)cin>>v[i];
	vl s1(1,0),s2(1,0);
	fore(i,0,a){
		if(s1.back()+u[i]<=d)s1.pb(s1.back()+u[i]);
		else break;
	}
	fore(i,0,b){
		if(s2.back()+v[i]<=d)s2.pb(s2.back()+v[i]);
		else break;
	}
	int mx = 0;
	fore(i,0,sz(s1)){
		int x= upper_bound(all(s2),d-s1[i])-s2.begin();
		if(x>0)x--;
		mx = max(mx,x+i);
	}
	fore(i,0,sz(s2)){
		int x= upper_bound(all(s1),d-s2[i])-s1.begin();
		if(x>0)x--;
		mx = max(mx,x+i);
	}
	cout<<mx<<ENDL;



}


Measured memory_bytes: 11000
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      
      	int hito = sc.nextInt();
      	int menu = sc.nextInt();
      	int mesi[] = new int[menu+1];
      
      for(int i = 0; i < hito; i++){
        int a = sc.nextInt();
      	for(int j = 0; j < a;j++){
        	mesi[sc.nextInt()] += 1;
        }
      }
		int cnt = 0;
		for(int i = 1; i <= menu ; i++){
          if(mesi[i]==hito){cnt++;}
        }
      	System.out.print(cnt);


    }
}

Measured memory_bytes: 24148
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        int p = scan.nextInt();
        
        int m = scan.nextInt();
        
        int c = scan.nextInt();
        System.out.println(p+m+c);
        
    }
}



Measured memory_bytes: 26196
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int Par[100],Rank[100];
void Init(int n) {
	for(int i=0;i<n;i++) {
		Par[i]=i;
		Rank[i]=0;
	}
}
int Find(int x) {
	if(Par[x]==x) {
		return x;
	}else {
		return Par[x]=Find(Par[x]);
	}
}
void Unite(int x,int y) {
	x=Find(x);
	y=Find(y);
	if(x==y) return;
	if(Rank[x]<Rank[y]) {
		Par[x]=y;
	}else {
		Par[y]=x;
		if(Rank[x]==Rank[y])Rank[x]++;
	}
}
bool Same(int x,int y) {
	return Find(x)==Find(y);
}
struct Edge {
	int u,v,cost;
	Edge(int _u,int _v,int _cost) {u=_u,v=_v,cost=_cost;}
	bool operator < (const Edge& E) const {return cost<E.cost;}
};
vector<Edge> es;
int main() {
	int n,m,a,b,d;
	while(scanf("%d",&n),n) {
		scanf("%d",&m);
		es.clear();
		for(int i=0;i<m;i++) {
			scanf("%d,%d,%d",&a,&b,&d);
			es.push_back(Edge(a,b,d));
		}
		sort(es.begin(),es.end());
		int res=0;
		Init(n);
		for(int i=0;i<es.size();i++) {
			if(!Same(es[i].u,es[i].v)) {
				Unite(es[i].u,es[i].v);
				res+=(es[i].cost/100-1);
			}
		}
		printf("%d\n",res);
	}
}

Measured memory_bytes: 1164
#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 ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	int h, w, k;
	cin >> h >> w >> k;
	vector<vector<int>> a(h, vector<int>(w));
	for(auto &rw : a){
		for(auto &x : rw){
			char c;
			cin >> c;
			x = c == '1';
		}
	}

	int res = h + w - 2;

	int mx = 1 << (h - 1);
	for(int msk = 0; msk < mx; ++msk){
		vector<int> row_sep(h), col_sep(w);
		int cnt = 0;
		for(int bit = 0; bit < h - 1; bit++){
			if((msk >> bit & 1) == 0) continue;
			row_sep[bit + 1] = true;
			cnt++;
		}
		assert(cnt == __builtin_popcount(msk));

		bool leave_msk = 0;
		int sz = cnt + 1;
		vector<int> tot(sz);
		for(int j = 0; j < w; ++j){
			vector<int> added;
			int sum = 0;
			for(int i = 0; i < h; ++i){
				if(row_sep[i]){
					added.push_back(sum);
					sum = 0;
				}
				sum += a[i][j];
			}
			added.push_back(sum);
			sum = 0;

			assert(added.size() == tot.size());

			bool repeat = 0;
			for(int i = 0; i < sz; ++i){
				if(added[i] > k) leave_msk = true;
				if(added[i] + tot[i] > k) repeat = true;
			}
			if(leave_msk) break;
			else if(repeat){
				col_sep[j] = true;
				j--;
				fill(all(tot), 0);
				cnt++;
			}
			else {
				for(int i = 0; i < sz; ++i){
					tot[i] += added[i];
				}
			}
		}
		if(not leave_msk){
			res = min(res, cnt);
		}
	}

	cout << res << endl;
	
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  //doubleのサイズは8バイト
  double ans=v[0];
  for (int i=1;i<n;i++) ans = (ans+v[i])/2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int n,i,input;
    scanf("%d",&n);
    int min=9999999;
    int max=-9999999;
    long long int sam=0;
    for(i=0;i<n;i++){
    scanf("%d",&input);
        if(min>input){
            min=input;
        }
        if(max<input){
            max=input;
        }
        sam=sam+(long long int)input;
     }
     printf("%d %d %lld\n",min,max,sam);
     return 0;
}

Measured memory_bytes: 600
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)

# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

def main():
	#A, P = map(int, input().split(" "))
	N = int(input())
	#S = input()

	SP = []
	for i in range(N):
		s, p = input().split(" ")
		p = int(p)
		SP.append((s,p,i+1))

	SP.sort()
	SP = sorted(SP, key=lambda x:(x[0],-x[1]))

	for i in SP:
		a, b, c = i
		print(c)

	


if __name__ == "__main__":
	main()

Measured memory_bytes: 3444
function spilitInput(input) {
  var splited = [];
  var rows = input.split('\n');
  for (var i = 0; i < rows.length; i += 1) {
    splited.push(rows[i].split(' '));
  }
  return splited;
}
function Main(input) {
  var splited = spilitInput(input);
  var S = splited[0][0];
  var ys = ['erase', 'dream', 'eraser', 'dreamer'];
  
while (S.length > 0) {
  var match = false;
  for (var i = 0; i < ys.length && !match; i += 1) {
    var word = ys[i];
    if (S.slice(-1 * word.length) == word) {
        match = true;
        S = S.slice(0, (S.length - word.length));
    }
  }
  if (!match) {
    break;
  }
}
  
  if (S.length > 0) {
    console.log('NO');
  } else {
    console.log('YES');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 33328
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner scan = new Scanner(System.in);
		String nostr = scan.nextLine();
		String str = scan.nextLine();
		
		String[] strs = str.split(" ");
		List<String> strs2 = Arrays.asList(strs);
		ArrayList<String> str3 = new ArrayList<String>(strs2);
		
		List<String> flg = new ArrayList<String>();
		str3.forEach(v ->{
			int iv = Integer.parseInt(v);
			if(iv%2==0) {
				if(iv%3==0 || iv%5==0) {
					flg.add("ok");
				}else {
					flg.add("ng");
				}
			}
		});
		
		if(flg.size()==0) {
			System.out.println("APPROVED");
		}else if(flg.contains("ng")) {
			System.out.println("DENIED");
		}else {
			System.out.println("APPROVED");
		}

	}

}

Measured memory_bytes: 28624
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
string n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  ll s_l = n.size();

  int sum = 0;
  REP(i, s_l) {
    sum += n[i] - '0';
    sum = sum % 9;
  }

  cout << (sum == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3776
// mod custom_lib;
use std::cmp;

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: u32) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: u32, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}


fn main() {
  let h = read::<usize>();
  let w = read::<u32>();

  let mut s = Vec::new();
  let mut s_point = Vec::new();

  for _ in 0..h {
    let mut row = Vec::new();
    for c in read::<String>().chars() {
      row.push(c);
    }
    s_point.push(calc_width_lamb(&row));
    s.push(row);
  }

  for w_idx in 0..w {
    let height_point = calc_height_lamb(&s, w_idx as usize);
    for (h_idx, v) in height_point.iter().enumerate() {
      if v != &0 {
        s_point[h_idx as usize][w_idx as usize] += v - 1;
      }
    }
  }

  // 結果
  let mut answer = 0;
  for item in s_point {
    answer = cmp::max(*item.iter().max().unwrap(), answer)
  }

  println!("{}", answer);
}

fn calc_height_lamb(map: &Vec<Vec<char>>, w_idx: usize) -> Vec<u32> {
  let mut height_row = vec![];
  for row in map {
    height_row.push(row[w_idx])
  }
  calc_width_lamb(&height_row)
}

fn calc_width_lamb(row: &Vec<char>) -> Vec<u32> {
  let mut row_copy = row.clone();
  row_copy.insert(0, '#');
  let last_idx = row_copy.len();
  row_copy.insert(last_idx, '#');

  let mut prev_sharp = 0;
  let mut result_vec = vec![0; row_copy.len()];

  for (i, v) in row_copy.iter().enumerate() {
    if v == &'#' {
      for idx in prev_sharp..i {
        result_vec[idx] = (i - prev_sharp) as u32;
      }
      prev_sharp = i + 1;
    }
  }

  result_vec.remove(0);
  result_vec.remove(last_idx - 1);
  result_vec
}


Measured memory_bytes: 37116
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int K = scanner.nextInt();
        long sum = 0;
        for(int i = 1; i <= K; i++) {
            for(int j = 1; j <= K; j++) {
                for(int k = 1; k <= K; k++) {
                    int arr[] = {i, j, k};
                    sum += findGCD(arr, 3);
                }
            }
        }


        System.out.println(sum);
    }


    // Function to return gcd of a and b
    private int gcd(int a, int b) {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    // Function to find gcd of array of
    // numbers
    private int findGCD(int arr[], int n) {
        int result = arr[0];
        for (int i = 1; i < n; i++) {
            result = gcd(arr[i], result);

            if (result == 1) {
                return 1;
            }
        }

        return result;
    }
}


Measured memory_bytes: 52332
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

typedef long long LL;
const int N = 2000 + 5;

int n, m;
char a[N][N];
int go[N];
int tol[N], tor[N];

int getp(int *p, int x)
{
    return p[x] == x ? x : p[x] = getp(p, p[x]);
}

void solve()
{
    scanf("%d%d", &n, &m);
    int ans = max(n, m);
    for(int i = 0; i < n; ++ i) {
        scanf("%s", a[i]);
        for(int j = 0; j < m; ++ j) {
            a[i][j] = (a[i][j] == '#');
        }
    }

    for(int j = m - 1; j >= 0; -- j) {
        vector<pair<int, int>> vec;
        tol[0] = 0; tor[n] = n;
        for(int i = 0; i + 1 < n; ++ i) {
            tol[i + 1] = i + 1;
            tor[i + 1] = i + 1;
            if (j == m - 1) {
                go[i] = 1;
            } else {
                if ((a[i][j] ^ a[i + 1][j]) == (a[i][j + 1] ^ a[i + 1][j + 1])) {
                    go[i] ++;
                } else {
                    go[i] = 1;
                }
            }
            vec.push_back(make_pair(go[i], i + 1));
        }

        sort(vec.rbegin(), vec.rend());
        for(int i = 0; i < vec.size(); ++ i) {
            int id = vec[i].second;
            tol[id] = id - 1;
            tor[id] = id + 1;
            ans = max(ans, (getp(tor, id) - getp(tol, id)) * vec[i].first);
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 4224
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ac = Counter(a)

ans = sum(a)
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b) * ac[b]
    ac[c] += ac[b]
    ac[b] = 0
    print(ans)


Measured memory_bytes: 24048
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

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

        String[] in = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        int k = Integer.parseInt(in[1]);

        System.out.println(n - k + 1);
        
        br.close();
    }
}

Measured memory_bytes: 21076
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 200005
#define inf INT32_MAX
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef pair<int,int> pr;
typedef pair<pair<int,int>, int> tup;

inline void solve()
{
	int n;
	cin >> n;
	vector<double> v(n);
	fore(i, 0, n)
		cin >> v[i];

	vector<vector<double>> dp(n, vector<double>(n + 1, 0));
	dp[0][0] = 1.0 - v[0];
	dp[0][1] = v[0];
	fore(i, 1, n)
	{
		fore(j, 0, n + 1)
		{
			if (j > 0)
				dp[i][j] += dp[i - 1][j - 1] * v[i];
			dp[i][j] += dp[i - 1][j] * (1.0 - v[i]);
		}
	}
	double otv = 0;
	fore(i, n / 2 + 1, n + 1)
		otv += dp[n - 1][i];
	cout << fixed << setprecision(10) <<  otv;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}




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

using namespace std;

typedef long long LL;
const int N = 110;

int main() {	
	int k, a, b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++) if (i % k == 0) {
		cout << "OK" << endl;
		return 0;
	} 
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3612
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "Yes" : "No")<<endl;
using namespace std;
 
#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
	tezz
 

	int n, t, s;
	cin >> n >> t >> s;
	output( (n/s + (n%s!=0)) <= t );
 
	return 0;
}  

Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a == b)
		printf("Draw\n");
	else if(a == 1)
		printf("Alice\n");
	else if(b == 1)
		printf("Bob\n");
	else if(a < b)
		printf("Bob\n");
	else
		printf("Alice\n");
	return 0;
}


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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

const int B = 1e9+7, H = 1e9+9;
//Hash(C) = (C1*B^(n-1)+...+Cn*B^0) mod H
int contain(string a,string b){
  if(a.size() > b.size()) return false;

  int t = 1,ah = 0,bh = 0;
  for(int i = 0; i < a.size(); i++) ah = ah*B + a[i],t *= B;
  for(int i = 0; i < a.size(); i++) bh = bh*B + b[i];

  int cnt = 0;
  for(int i = a.size(); i <= b.size(); i++){
    if(ah == bh) cnt++;
    if(i >= b.size()) break;
    bh = bh*B + b[i] - b[i-a.size()]*t;
  }
  return cnt;
}

signed main(){

  int n; cin >> n;
  vector<tuple<string,string,string>> v(n);
  for(int i = 0; i < n; i++){
    string a,b,c; cin >> a >> b >> c;
    v[i] = make_tuple(a,b,c);
  }

  int q; cin >> q;
  for(int i = 0; i < q; i++){
    string a,b,c,d; cin >> a >> b >> c >> d;
    if(i) cout << endl;
    for(int j = 0; j < n; j++){
      string e = get<0>(v[j]);
      string f = get<1>(v[j]);
      string g = get<2>(v[j]);
      bool judge = true;
      if(!(a == "*" || contain(a,e))) judge = false;
      if(!(b == "*" || contain(b,f))) judge = false;
      if(!(c == "*" || c <= g)) judge = false;
      if(!(d == "*" || d >= g)) judge = false;
      if(judge) cout << e << endl;
    }
  }

  return 0;
}



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

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

  ll s = a[0] + a[1], x = 0;
  for (int i = 2; i < n; i++) x ^= a[i];
  if ((s - x) & 1) {cout << -1 << endl; return 0; }
  ll d = (s - x) / 2;
  if ((d & x) || (d < 0) || (d > a[0])) { cout << -1 << endl; return 0; }

  ll m = 1;
  m = m<<40;
  ll a0 = d;
  rep(_, 41) {
    if (m & x) {
      if (a0 + m <= a[0]) a0 += m;
    }
    m = m>>1;
  }
  if (a0 <= 0) { cout << -1 << endl; return 0; }

  cout << a[0] - a0 << endl;

  return 0;
}

/*
*/


Measured memory_bytes: 3632
MOD = 10 ** 9 + 7

count = [0 for i in range(100000 + 89)]

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	ans = 1
	available_color = 3
	for x in L:
		if x == 0:
			ans *= available_color
			available_color -= 1
			count[0] += 1
		else:
			ans *= count[x - 1]
			count[x - 1] -= 1
			count[x] += 1
	print(ans % MOD)

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

int main()
{
  string s;
  cin >> s;
  string ans = "No";
  for (int i = 0; i < s.size(); i++)
  {
    if (s[i] == '7')
    {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
bool g[52][52];
bool used[52];

int dfs(int p){
  used[p] = true;
  int ret = 1;
  REP(to,n){
    if(used[to])continue;
    if(!g[p][to])continue;
    ret += dfs(to);
  }
  return ret;
}

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    g[a][b] = g[b][a] = true;
  }
  int ans = 0;
  REP(i,n)REP(j,i){
    if(g[i][j]){
      g[i][j] = false;
      g[j][i] = false;
      REP(k,n)used[k]=false;
      if(dfs(0)!=n){
        ans++;
      }
      g[i][j] = true;
      g[j][i] = true;
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
a,b,c,d=map(int,input().split())

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def ko(x):
  a1=x//c
  a2=x//d
  return x-(a1+a2-x//lcm(c,d))

print(ko(b)-ko(a-1))

Measured memory_bytes: 5360
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,d;
    cin >> n >> d;
    long x[n];
    long y[n];
    for(int i=0;i<n;i++)cin >> x[i] >> y[i];
    int ans = 0;
    for(int i=0;i<n;i++){
        if(x[i]*x[i] + y[i]*y[i] <= d*d)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6744
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
 
int main() {
  long double X;
  cin >> X;
  ULL Y = 100, ans = 0;
  while(Y < X) {
    Y *= 1.01;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3732
#include<iostream>
using namespace std;
int main(){
    int a[100],i,n,j;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<a[n-1];
    for(j=n-2;j>=0;j--){
        cout<<" "<<a[j];
    }
    cout<<endl;
    
    return 0;
}

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

const long long maxn = 1e6;

long long a[maxn];

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

	long long n;
	cin >> n;

	for(long long i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a+n);

	long long l = 0, r = n-1;
	while(l < r){
		long long t = (l+r)/2;

		long long s = 0;
		for(int i = 0; i <= t; i++) s += a[i];
		long long k = t+1;
		while(k < n && 2*s >= a[k]) s += a[k++];

		if(k == n) r = t;
		else l = t+1;
	}

	cout << n-l;

	return 0;
}

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

const int MINS = -2000;

typedef pair<string, string> P;

map<string, int > id;
string str[1005];
vector<int> vec[1005];
vector<string> data[105];
int flag[1005][1005]={};
vector<P> output;

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

  int n,f;
  cin >> n >> f;
  
  int index = 1;
  for(int i=0;i<n;i++){
    int m;
    cin >> m;
    for(int j=0;j<m;j++){
      string s;
      
      cin >> s;
      data[i].push_back(s);
      if(id[s] == 0){
	id[s] = index;
	str[ id[s] ] = s;
	++index;
      }
    }
    
    for(int k=0;k<data[i].size();k++){
      string s;
      int idx;
      s = data[i][k];
      idx = id[s];
      for(int l=0;l<m;l++){
	if(s == data[i][l]) continue;
	vec[idx].push_back( id[ data[i][l] ] );
      }
    }
  }
  
  /*
  for(int i=1;i<index;i++){
    cout << i << " = "; 
    for(int j=0;j<vec[i].size();j++){
      cout << vec[i][j] << ' ';
    }
    cout << endl;
  }
  */
  //for(int i=0;i<index;i++) sort(vec, vec+index);

  int ans=0;
  for(int i=1;i<index;i++){
    int count[1005]={};
    for(int j=0;j<vec[i].size();j++){
      int idx = vec[i][j];
      count[idx]++;
      //cout << count[idx] << ' ' << str[idx] << endl;
      if(count[idx] >= f && flag[i][idx] == 0) {
	if(str[i] < str[idx]){
	  output.push_back(P(str[i], str[idx]));
	} else {
	  output.push_back(P(str[idx], str[i]));
	}
	ans++;
	count[idx] = MINS;
	flag[i][idx] = flag[idx][i] = 1;
	
      }
    }
  }

  cout << ans << endl;
  sort(output.begin(), output.end());
  for(int i=0;i<ans;i++){
    cout << output[i].first << ' ' << output[i].second << endl;
  }

  

  return 0;
}



Measured memory_bytes: 7380
#include <string.h>

int main(void){
  int i,j,x[30];

  memset(x,0,sizeof(x));
  for(i=0;i<28;i++){
    scanf("%d",&j);
    x[j-1] = 1;
  }
  for(i=0;i<30;i++){
    if(!x[i]) printf("%d\n",i+1);
  }

  return 0;
}

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


int main(){
    char s[10];
    int a,b,c;
    cin >> s;
    sscanf(s,"%d/%d/%d",&a,&b,&c);
    if (a<=2018 || (a==2019 && b <= 4)){
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" << endl;
    }

    
}

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

vector<int> st;
vector<int> top;

vector<int> calc(int a, int b, int n) {
    if (n == 1) return {a, b};
    int s = __builtin_ffs(a^b);
    int t = 0;
    if ((a & (1 << (s-1))) != 0) t = (1 << (s-1));
    int u = (1 << (s-1)) - 1;
    int aa = (a & u) + ((a >> 1) & ~u);
    int bb = (b & u) + ((b >> 1) & ~u);
    int d = aa ^ 1;
    //cout << a << b << " " << aa << " " << bb << " " << d <<  endl;
    vector<int> e = calc(aa, d, n-1), f = calc(d, bb, n-1);
    for (int i = 0; i < (int)e.size(); i++) e[i] = ((e[i] & ~u) << 1) + t + (e[i] & u);
    for (int q : f) e.push_back(((q & ~u) << 1) + u + 1 - t + (q & u));
    return e;
}

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    if (__builtin_parity(A^B) == 0) {
        cout << "NO" << endl;
        return 0;
    }
    
    vector<int> ans = calc(A, B, N);
    
    cout << "YES\n";
    for (int i = 0; i < (1<<N); i++) {
        if (i < (1<<N)-1) printf("%d ", ans[i]);
        else printf("%d\n", ans[i]);
    }
    return 0;
}


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

int main()
{
    ll N;
    cin >> N;
    ll a[N];
    ll S[N+1];
    S[0] = 0;
    for(ll i = 0; i < N; i++)
    {
        cin >> a[i];
        S[i+1] = S[i] + a[i];
    }

    ll minS = 9223372036854775807;
    ll sum = 0;

    for(ll i = 0; i < N-1; i++)
    {
        sum += a[i];
        if(minS > abs((S[N]-sum)-sum))
        {
            minS = abs((S[N] - sum)-sum);
        }
    }
    cout << minS << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int isprime[100001],prime[100001];
int sum[100001]={0};
void Euler_sieve(int n)
{
	memset(isprime,0,sizeof(isprime));
	isprime[0]=isprime[1]=1;
	prime[0]=0;
	int i,j,total=0;
	for(i=2;i<=n;i++)
	{
		if(!isprime[i])
		{
			prime[++prime[0]]=i;
			if(!isprime[(i+1)/2])
			{
				total++;
			}
		}
		sum[i]=total;
		for(j=1;j<=prime[0]&&i*prime[j]<=n;j++)
		{
			isprime[i*prime[j]]=1;
			if(i%prime[j]==0)
				break;
		}
	}
}
int main()
{
	int n,i,a,b;
	scanf("%d",&n);
	Euler_sieve(100001);
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&a,&b);
		printf("%d\n",sum[b]-sum[a-1]);
	}
	return 0;
}


Measured memory_bytes: 1408