akhauriyash/Code-Regression huggingface dataset:
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

const ll MOD = 998244353;

ll modp(ll x, ll y, ll p){  
    ll res = 1;
    x = x % p;
    while (y > 0){  
        if (y & 1){ 
            res = (res * x) % p; 
        } 
        y = y >> 1;
        x = (x * x) % p;  
    }  
    return res % p;  
}

void solve(){
    ll n, s;
    cin >> n >> s;
    vector<ll> a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    ll dp[n + 1][s + 1];
    ll inv = modp(2, MOD - 2, MOD);
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= s; j++){
            dp[i][j] = 0;
        }
    }
    dp[0][0] = modp(2, n, MOD);
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= s; j++){
            dp[i][j] = dp[i - 1][j];
            if(j >= a[i]){
                dp[i][j] += (dp[i - 1][j - a[i]] * inv);
            }
            dp[i][j] %= MOD;
        }
    }
    cout << dp[n][s] % MOD << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 74004
#include <iostream>
using namespace std;
 
int main(int argc, const char * argv[]) {    
    int N, K;
    cin >> N;
    cin >> K;
    
    if (K < 2) {
        cout << 0 << endl;
        return 0;
    }
    
    cout << N - K << endl;
    
    return 0;
}

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

// #define deb(x) cout << #x << " " << x << endl;
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"

#define ll  long long
#define all(c) (c).begin(),(c).end()
#define nl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll; typedef map< int, int> mll;
int t[100][100];

void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}





int main() {
 
    int i;

    c_p_c();
    int a[5];
    fo(i,5) cin>>a[i];
    for (int i = 0; i < 5; ++i)
    {
        if(a[i]==0){
            cout<<i+1<<endl;
            return 0;
        }
    }
  return 0;

}

Measured memory_bytes: 3584
var n,i,j,ans,num,now:longint;
var c,s,f:array[0..1020] of longint;
begin
  read(n);
  for i:=1 to n-1 do read(c[i],s[i],f[i]);
  for i:=1 to n-1 do
  begin
    ans:=s[i]+c[i];now:=i+1;
    while now<n do
    begin
      if s[now]>=ans then begin ans:=s[now]+c[now];inc(now);continue;end;
      if s[now]<ans then begin
        if (ans-s[now]) mod f[now]=0 then begin inc(ans,c[now]);inc(now);
        continue;end;
        ans:=((ans-s[now]) div f[now]+1)*f[now]+s[now]+c[now];
        inc(now);
      end;
    end;
    writeln(ans);
  end;
  writeln(0);
end.

Measured memory_bytes: 128
player1, player2 = 0, 0
n = int(input())
for i in range(n):
    card1, card2 = str(input()).split()
    if card1 > card2:
        player1 += 3
    elif card1 < card2:
        player2 += 3
    else:
        player1 += 1
        player2 += 1
print('{} {}'.format(player1, player2))


Measured memory_bytes: 5596
N=int(input())
#cmdから2次元配列Gを作成
G = []
for i in range(N):
    array = list(input().strip().split())
    G.append(array)
for i, alpha in enumerate(G):
    alpha.append(i)
for i in range(0,N):
    y=G[i][1]
    G[i][1]=int(y)


#print(G)
tmp = sorted(G, key=lambda x:x[1], reverse=True)
b= sorted(tmp, key=lambda x:x[0])
#print(b)
for i in range (0,N):
    print(int(b[i][2])+1)


Measured memory_bytes: 3064
S = input()

def kaibunCheck(str):
    s = 0
    e = len(str)-1

    while(s < e):
        if(str[s]!=str[e]):
            return False
        s +=1
        e-=1
    return True


c = kaibunCheck(S) and kaibunCheck(S[0:(len(S)-1)//2])

if(c):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5;
int n,m;
int fa[MAXN];
int gtf(int x)
{
	if(fa[x]!=x) fa[x]=gtf(fa[x]);
	return fa[x];
}
void uni(int x,int y)
{
	int anx=gtf(x),any=gtf(y);
	if(anx==any) return ;
	else fa[anx]=any;
	return ;
}
int main()
{
	int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++) fa[i]=i;
	for(i=1;i<=m;i++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		uni(x,y);
	}
	int ans=0;
	for(i=1;i<=n;i++)
		if(fa[i]==i) ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s,t;
    std::vector<vector<string>> vec(n,vector<string>(2));
    for (int i=0;i<n;i++) {
        cin>>s>>t;
        vec[i][0]=s;
        vec[i][1]=t;
    }
    int flag=0,sum=0;
    string x;
    cin>>x;
    for (int i=0;i<n;i++) {
        if (flag==0) {
            if (vec[i][0]==x) {
                flag=1;
            }
        } else {
            sum+=stoi(vec[i][1]);
            //cout<<sum<<endl;
        }
    }
    cout<<sum<<endl;
}

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

struct P{
  double x, y, z;
  P():x(0), y(0), z(0){}
  P(double x, double y, double z):x(x), y(y), z(z){}
  P operator+(const P& b)const{
    P res;
    res.x = x + b.x;
    res.y = y + b.y;
    res.z = z + b.z;
    return res;
  }
  P operator-(const P& b)const{
    P res;
    res.x = x - b.x;
    res.y = y - b.y;
    res.z = z - b.z;
    return res;
  }
  bool operator<(const P& b)const{
    if(x == b.x)
      if(y == b.y)
        return z < b.z;
      else
        return y < b.y;
    else
      return x < b.x;
  }
};

bool eq(double a, double b){
  return abs(a-b) < 0.0001;
}

// Experimence
int main(void){
  int T; cin >> T;
  while(T--){
    double QR, RP, PQ; cin >> QR >> RP >> PQ;
    double P_arg = acos((PQ*PQ+RP*RP-QR*QR) / (2*PQ*RP));
    double Q_arg = acos((PQ*PQ+QR*QR-RP*RP) / (2*PQ*QR));
    double R_arg = acos((QR*QR+RP*RP-PQ*PQ) / (2*QR*RP));
    int N; cin >> N;
    vector<P> points(N);
    for(int i = 0; i < N; i++){
      cin >> points[i].x >> points[i].y >> points[i].z;
    }
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        for(int k = 0; k < N; k++){
          if(i == j || j == k || i == k) continue;
          vector<P> triangle(3);
          triangle[0] = points[i];
          triangle[1] = points[j];
          triangle[2] = points[k];

          //do{
            vector<double> edge(3);
            for(int edge_idx = 0; edge_idx < 3; edge_idx++){
              P subtract = triangle[edge_idx%3] - triangle[(edge_idx+1)%3];
              edge[edge_idx] = sqrt(subtract.x*subtract.x + subtract.y*subtract.y + subtract.z*subtract.z);
            }
            double arg1, arg2, arg3;
            arg1 = acos((edge[0]*edge[0]+edge[2]*edge[2]-edge[1]*edge[1]) / (2*edge[0]*edge[2]));
            arg2 = acos((edge[0]*edge[0]+edge[1]*edge[1]-edge[2]*edge[2]) / (2*edge[0]*edge[1]));
            arg3 = acos((edge[1]*edge[1]+edge[2]*edge[2]-edge[0]*edge[0]) / (2*edge[1]*edge[2]));
            //DEBUG
            if(eq(P_arg, arg1) && eq(Q_arg, arg2) && eq(R_arg, arg3)){
              cout << i+1 << " " << j+1 << " " << k+1 << endl;
              i = N; j = N; k = N;
            }
          //}while(next_permutation(triangle.begin(), triangle.end()));

          //cout << i << j << k << endl;
        }
      }
    }
  }
}

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

int main() {
  string x, y, z;
  cin >> x >> y >> z;
  cout << z + " " + x  + " " +  y << endl;
  return 0;
}

Measured memory_bytes: 3548
import sys

x = []

for line in sys.stdin.readlines():
  x.append(line.strip())

max = -(10**9)
min = int(x[1])

for i in range(2, int(x[0])+1):
  sa = int(x[i]) - min
  if max < sa:
    max = sa
  if min > int(x[i]):
    min = int(x[i])

  

print max

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  cin >> n >> m;
  ll a,b;
  map<ll,ll> k;
  rep(i,m){
    cin >> a >> b;
    k[a]++;
    k[b]++;
  }
  rep(i,n){
    if(k[i+1] % 2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

int main() {
    int64_t L, R, d;
    cin >> L >> R >> d;
    int64_t ans = 0;
    for (int64_t i = L; i <= R; i++) {
        if (i % d == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
 
int main(void) {
    int count,max;
    int i;
    int ball[10];
    int left,right;
    scanf("%d",&max);
    for(count=0;count<max;count++) {
        for(i=0;i<10;i++)scanf("%d",&ball[i]);
        left=0;right=0;
        for(i=0;i<10;i++) {
            if(ball[i]<left && ball[i]<right)break;
            if(ball[i]<left)right=ball[i];
            else if(ball[i]<right)left=ball[i];
            else {
                if(left<right)right=ball[i];
                else left=ball[i];
            }
        }
        if(i>=10)printf("YES\n"); else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 2032
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N =sc.nextInt();
		int B =0;
		int L =0;
		int O =0;
		int P =0;
		int Q =0;
		int R =0;
		int min = 100000;
		
		for(int A=1; A<N; A++){
			B=N-A;
			P=A;
			L=0;
			O=0;
			R=0;			
			for(int X=0;X<=6;X++){
				L += B%10;
				B = B/10;
			}	
			for(int Y=0;Y<=6;Y++){
				O +=P%10;
				P = P/10;
			}
			
			R = L+O;
			if(R<min){
				min = R;
			}
		}
		System.out.println(min);
	}
}	

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

int digit_sum(int X) {
    int result = 0;
    while (X > 0) {
        result += X % 10;
        X /= 10;
    }
    return result;
}

int main () {
    int N , A , B;
    cin >> N >> A >> B;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(digit_sum(i)  >= A && digit_sum(i) <= B){
            ans+=i;
        }
    }
    cout << ans << endl;
}


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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

string bn;
	
	getline(cin,bn);
	rep(i,bn.size()) 
		if(bn[i] >= 'a' && bn[i] <= 'z') bn[i] += 'A' - 'a';

	cout << bn << endl;
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <cstring> // memset()
#include <cmath> // pow(a, b)
#include <string> // string, stoi(string)
#include <cstdlib> //abs(int x)
#include <bitset> //bitset<int>(int)
using namespace std;

const int INF = 1 << 30;


int solve(int d, int g, int* p, int* c){
  int bit = 1 << d; // int なので30以下が良い intで存在できるのは {pow(2, 31) - 1} までなので
  int count = INF;
  for (int i=0; i<bit; i++) {
    // for文で部分集合に対しての処理を書く
    int point = 0;
    int acc = 0;
    for (int j=0; j<d; j++){
      if (i>>j & 1){
        acc += p[j+1];
        point += (j+1)*p[j+1] + c[j+1];
      }
    }
    if (point >= g) {
      count = min(count, acc);
    } else {
      for (int j=d-1; j>=0; j--){
        if (!(i>>j & 1)){
          // cout << "i :"<< i<<"j :" << (j-1) << endl;
          // cout << g <<" "<< point << endl;
          if ((g-point+j)/(j+1) > p[j+1]){
            break;
          } else {
            acc += (g-point+j)/(j+1);
            count = min(count, acc);
            break;
          }
        } else {
          continue;
        }
      }
    }
  }
  return count;
}


int main(){
  int d, g;
  cin >> d >> g;
  g = g/100;
  int p[d+1], c[d+1];
  p[0] = c[0] = 0;
  for (int i=1; i<=d; i++){
    cin >> p[i] >> c[i];
    c[i] = c[i] /100;
  }

  cout << solve(d, g, p, c) << endl;
  
}



Measured memory_bytes: 256
require 'prime'

class Fof
  def solve
    n = gets.chomp.to_i
    return 1 if n == 1

    ph = {}
    
    (2..n).each do |x|
      Prime.prime_division(x).each do |p|
        if ph[p[0]]
          ph[p[0]] += p[1]
        else
          ph[p[0]] = p[1]
        end
      end
    end

    ans = 1

    ph.values.each do |x|
      ans = ans * (x+1) % 1000000007
    end

    ans
  end
end

if $0 == __FILE__
  puts Fof.new.solve
end


Measured memory_bytes: 2300
<?php
	fscanf(STDIN, "%d", $N);
	$input = explode(' ', trim(fgets(STDIN)));

	$count = 0;
	$i = 0;
	while ($i < $N-1) {
      if ($input[$i] > $input[$i+1]) {
        $count++;
		if ($input[$input[$i]-1] != $i+1) {
          echo ('NO');
          return ;
        } else {
          $tmp = &$input[$i];
          $input[$i] = &$input[$input[$i]-1];
          $input[$input[$i]-1] = $tmp;
        }
      }
      $i++;
    }

	if ($count > 1) {
      echo ('NO');
    } else {
		echo ('YES');
    }

?>

Measured memory_bytes: 3576
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  ans = 2000
  D, G = map(int, input().split())
  P = [0]*D
  C = [0]*D
  for i in range(D):
    P[i],C[i] = map(int, input().split())
  for p in product([0,1],repeat=D):
    if sum(p)<D:
      for i in range(D-1,-1,-1):
        if p[i]==0:
          maxi = i
          break
    cnt = 0
    score = 0
    for i in range(D):
      if p[i]==1:
        score += (i+1)*100*P[i]+C[i]
        cnt += P[i]  
    if -(-(G-score)//(100*(maxi+1)))>=P[maxi]:
      continue
    if G>score:
      cnt += -(-(G-score)//(100*(maxi+1)))
    ans = min(ans,cnt)
  return ans
print(solve())

Measured memory_bytes: 9248
use std::collections::hash_set::HashSet;

fn main() {
    let (n, v) = read();
    let ans = solve(n, v);
    write(ans);
}

fn read() -> (i32, Vec<String>) {
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let n: i32 = l1.trim().parse().unwrap();

    let mut v: Vec<String> = Vec::new();
    for i in 0..n {
        let mut l1 = String::new();
        std::io::stdin().read_line(&mut l1).ok();
        v.push(l1.trim().to_string());
    }

    (n, v)
}

fn write(s: i32) {
    println!("{}", s);
}

fn solve<'a>(n: i32, v: Vec<String>) -> i32 {
    let hs: HashSet<String> = v.into_iter().collect();
    hs.len() as i32
}


Measured memory_bytes: 19324
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using namespace std;
using ll = long long;

template<class T, T monoid>
class RMQ{
public:
  vector<T> dat;
  int _n;

  RMQ(int size) : _n{1}{
    while(size > _n) _n *= 2;
    dat.resize(2*_n-1, monoid);
  } 

  void update(int k, T a){
    k += _n-1;
    dat[k] = a;

    while(k > 0){
      k = (k-1) / 2;
      dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  T query(int a, int b){
    return _query(a, b, 0, 0, _n);
  }

  const T operator[](int i) const {
    assert(i >= 0 && i < _n);
    return dat[i + _n - 1];
  }
private:
  T _query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) {
      return monoid;
    }
    if(a <= l && r <= b) {
      return dat[k];
    }
    else {
      T v1 = _query(a, b, k * 2 + 1, l, (l + r) / 2);
      T v2 = _query(a, b, k * 2 + 2, (l + r) / 2, r);

      return max(v1, v2);
    }
  }
};

int main(){
  int n; cin >> n;
  int h[n], a[n];
  REP(i, n) cin >> h[i];
  REP(i, n) cin >> a[i];

  RMQ<ll, 0LL> rmq(n+1);
  REP(i, n){
    ll be = rmq.query(0, h[i]);
    rmq.update(h[i], be + a[i]);
  }

  cout << rmq.query(0, n+1) << endl;

  return 0;
}


Measured memory_bytes: 5888
#回文かどうかを判定するプログラム
def is_kaibun(s:str) -> int:
    if len(s)%2 != 0:
        front = s[0:len(s)//2]
        end = s[len(s)//2+1:len(s)]
    else:
        front = s[0:len(s)//2]
        end = s[len(s)//2:len(s)]
    if front == end[::-1]:
        return 1
    else:
        return 0

def main():
    s = input()
    buf1 = s[0:(len(s)-1)//2]
    buf2 = s[(len(s)+3)//2-1:len(s)]
    if is_kaibun(s)  == 1 and is_kaibun(buf1) == 1 and is_kaibun(buf2) == 1:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	static int h, w;
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		input();
		while (h != 0 && w != 0){
			drawLine();
			input();
		}

	}
	static void drawLine () {
		String oddLine = makeOddLine(w);
		String evenLine = makeEvenLine(w);
		for (int i = 0; i < h; i++){
			if (i % 2 == 0) System.out.println(oddLine);
			else
				System.out.println(evenLine);
		}
		System.out.println();
	}
	static void input (){
		h = sc.nextInt();
		w = sc.nextInt();
	}

	static String makeOddLine(int n) {
		StringBuilder line = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				line.append("#");
			} else {
				line.append(".");
			}
		}
		return line.toString();
	}

	static String makeEvenLine(int n) {
		StringBuilder line = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				line.append(".");
			} else {
				line.append("#");
			}
		}
		return line.toString();
	}

}

Measured memory_bytes: 27388
#include <cstdio>
#include <array>
using namespace std;

static inline int in()
{
    int c, n = 0;
    while ((c = getchar_unlocked()) >= '0' && c <= '9')
		n = 10 * n + (c - '0');
    return n;
}

static inline void out(int n)
{
	static char buf[20];
	char *p = buf;
	if (!n)
		*p++ = '0';
	else
		while (n)
			*p++ = n % 10 + '0', n /= 10;
	while (p-- != buf)
		putchar_unlocked(*p);
}

static inline void out(char c) {
	putchar_unlocked(c);
}

int main()
{
	int n = in(), c = n;

	array<int, 10001> b = {};

	while (n--)
		b[in()]++;

	for (int i = 0; c; i++)
		while (b[i]--) {
			out(i);
			if (--c)
				out(' ');
		}
	out('\n');
}


Measured memory_bytes: 2588
import math

N = int(input())
D = []

for k in range(N):
    x,y = map(int,input().split())
    D.append([x,y])

ans = 0

for i in range(N):
    for j in range(N):
        ans += math.sqrt((D[i][0]-D[j][0])**2 +(D[i][1]-D[j][1])**2)

print(ans/N)


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fin(x) cout << x << endl;

using namespace std;
using ll = long long;

int main(void) {
  ll n, k;
  cin >> n >> k;
  if (k == 0) {
    cout << n << endl;
  } else {
  cout << min(n % k, k - n % k) << endl;
}
  return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a^b^c) << "\n";
    
    return 0;
}

Measured memory_bytes: 256
import collections 
na=int(input())
n=1
mod = 10**9+7
for i in range(2,na+1):
    n*=i
#print(n)

n_break=[]
i=2
while i<=n:
    if n%i==0:
        n_break.append(i)
        n=n//i
    else:
        i+=1
#print(n_break)
ans=1
count=collections.Counter(n_break)
for v in count.values():
    ans*=(v+1)  #約数の総数

print(ans%mod)


Measured memory_bytes: 3564
K=int(input())
List=[1,2,3,4,5,6,7,8,9]
N=0
M=9
while len(List)<K:
    for i in range(N,M):
        last_number=List[i]%10
        times10=10*List[i]
        if last_number!=0:
            List.append(times10+last_number-1)
        List.append(times10+last_number)
        if last_number!=9:
            List.append(times10+last_number+1)
    N=M
    M=len(List)
   

print(List[K-1])

Measured memory_bytes: 11660
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int main (void) {
	ios::sync_with_stdio (false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = min (b, d) - max (a, c);
	a = max (0, a);
	cout << a << endl;

	return 0;
}

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

namespace ProblemC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var iterMax = (int)(Math.Ceiling(Math.Sqrt(N)));
            var resList = new int[N + 1];
            for (int i = 1; i <= iterMax ; i++)
            {
                for (int j = 1; j <= iterMax; j++)
                {
                    for (int k = 1; k <= iterMax; k++)
                    {
                        var n = i * i + j * j + k * k + i * j + j * k + k * i;
                        if (n <= N) resList[n]++;
                    }
                }
            }

            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            
            for (int i = 1; i <= N; i++)
            {
                Console.WriteLine(resList[i]);
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
ll gcd(ll a, ll b) {
  if (b==0) return a;
  return gcd(b, a%b);
}

int main(){
  ll n;
  cin>> n;
  vll a(n);
  for (ll i=0;i<n;i++) {
    cin >> a[i];
  }
  
  ll ma;
  if (n==2) {
    ma=max(a[0],a[1]);
  }
  if (n==3) {
    ma=max({gcd(a[0],a[1]),gcd(a[0],a[2]),gcd(a[1],a[2])});
  }
  
  
  
  if (n>3) {
  vll b(n),c(n);
  b[0]=a[0];
  for (ll i=1;i<n;i++) {
    b[i]=gcd(b[i-1],a[i]);
  }
  
  c[n-1]=a[n-1];
  for (ll i=n-2;i>=0;i--) {
    c[i]=gcd(c[i+1],a[i]);
  }
  
  ma=c[1];
  for (ll i=1;i<n-2;i++) {
    if (ma<gcd(b[i-1],c[i+1])) {
      ma=gcd(b[i-1],c[i+1]);
    }
  }
  if (ma<b[n-2]) {
    ma=b[n-2];
  }
  }
  
  cout<<ma;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	int64_t ans=0,plc,tmp;
	for(int i=0;i<(1<<(s.size()-1));++i){
		tmp=0,plc=1;
		for(int j=0;j<s.size();++j){
			tmp+=(s.at(j)-'0')*plc;
			plc*=10;
			if(i&(1<<j)){
				ans+=tmp;
				tmp=0;
				plc=1;
			}
		}
		ans+=tmp;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll = long long int;

int main(void) {
    int n; cin >> n;
    string s; cin >> s;
    if (n % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }
    string t1 = s.substr(0, n / 2), t2 = s.substr(n / 2);
    if (t1 == t2) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
  string s;
  cin >> s;
  int snum = s.size()-1;
  int k = (1 << snum);
  int c = 0;
  int64_t sum = 0;
  for(int i=0;i<k;i++){
    int64_t p = i;
    int64_t c = 1;
    int64_t ct = 0;
    for(int j=0;j<snum;j++){
      if(p&1){
        sum += stol(s.substr(ct,c));
        ct += c;
        c = 0;
      }
      c++;
      p = p >> 1;
    }
    sum += stol(s.substr(ct,c));
  }
  cout << sum << endl;
}

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

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,k,i,j,p=0,q=0;
	ll x[123456],ans=INFLL;
	cin >> n >> k;
	for(i=0; i<n; ++i){
		cin >> x[i];
		if(x[i]<=0ll){
			++p;
		}
		if(x[i]>=0ll){
			++q;
		}
	}
	if(p == n){
		cout << (abs(x[n-k])) << endl;
		return 0;
	}else if(p == 0){
		cout << (abs(x[k-1])) << endl;
		return 0;
	}
	if(p >= k){
		ans = min(ans,abs(x[p-k]));
	}
	if(q >= k){
		ans = min(ans,abs(x[n-q+k-1]));
	}
	if(x[p-1]==0ll){
		--p; --q; --k;
	}
	for(i=1; i<k; ++i){
		j = k-i;
		if(p >= i && q >= j){
			ans = min(ans,abs(x[p-i])+2*abs(x[n-q+j-1]));
			ans = min(ans,2*abs(x[p-i])+abs(x[n-q+j-1]));
		}
	}
	cout << ans << endl;
	return 0;
}


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

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    rrep(i, 1, n) {
        if (i % 2) continue;
        bool f = true;
        rep(j, 0, i / 2) {
            if (s[j] != s[j + i / 2]) f = false;
        }
        if (f) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// abc091_b
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v)                                                              \
  rep(i, v.size()) cout << " " << v[i];                                        \
  cout << endl << endl;
#define show2d(v)                                                              \
  rep(i, v.size()) {                                                           \
    rep(j, v[i].size()) cout << " " << v[i][j];                                \
    cout << endl;                                                              \
  }                                                                            \
  cout << endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main(int argc, char *argv[]) {
  int n, m, ans = 0;
  cin >> n;
  vector<string> blue(n);
  rep(i, n) { cin >> blue[i]; }

  cin >> m;
  vector<string> red(m);
  rep(i, m) { cin >> red[i]; }

  auto func = [&](string s) {
    int cnt = 0;
    for (string t : blue) {
      if (s == t)
        cnt++;
    }
    for (string t : red) {
      if (s == t)
        cnt--;
    }
    return cnt;
  };

  for (string t : blue) {
    ans = max(ans, func(t));
  }

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


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

#define MAX 500000
#define INFTY 2000000000

int Left[MAX / 2 + 2], Right[MAX / 2 + 2];
int count_rep;

void merge(int A[], int size, int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	for (int i = 0; i < n1; ++i) {
		Left[i] = A[left + i];
	}
	for (int i = 0; i < n2; ++i) {
		Right[i] = A[mid + i];
	}
	Left[n1] = Right[n2] = INFTY;
	int i = 0, j = 0;
	for (int k = left; k < right; ++k) {
		++count_rep;

		if (Left[i] <= Right[j]) {
			A[k] = Left[i++];
		}
		else {
			A[k] = Right[j++];
		}
	}
}

void merge_sort(int A[], int size, int left, int right) {
	if(left + 1 < right){
	int mid = (left + right) / 2;
	merge_sort(A, size, left, mid);
	merge_sort(A, size, mid, right);
	merge(A, size, left, mid, right);
	}
}

int main() {
	int A[MAX], size;
	count_rep = 0;
	cin >> size;
	for (int i = 0; i < size; ++i) {
		cin >> A[i];
	}
	merge_sort(A, size, 0, size);
	for (int i = 0; i < size; ++i) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << count_rep << endl;
	return 0;
}

Measured memory_bytes: 5060
//arc063_c.cpp
//Sun Jun 10 13:42:30 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

	int ans;

	for (int i=1;i<s.size();i++){
		if (s[i]!=s[i-1]){
			ans++;
		}
	}

	cout << ans << endl;
}

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

#define ll long long
	
int A, B, C,ans;
int mod;

int main()
{
	cin >> A >> B >> C;
	if (A % 2)mod++;
	if (B % 2)mod++;
	if (C % 2)mod++;
	if (mod == 0||mod==3) {
		ans = (max(A, max(B,C)) * 3 - A - B - C) / 2;
	}
	else if (mod == 1) {
		if (max(A, max(B, C)) % 2) {
			ans = (((max(A, max(B, C)) - 1) * 3) - A - B - C+1) / 2+1;
		}
		else {
			ans = (max(A, max(B, C)) * 3 - A - B - C + 1) / 2 + 1;
		}
	}
	else if (mod == 2) {
		if (max(A, max(B, C)) % 2) {
			ans = (max(A, max(B, C)) * 3 - A - B - C + 1) / 2 + 1;
		}
		else {
			ans = (((max(A, max(B, C)) - 1) * 3) - A - B - C + 1) / 2 + 1;
		}
	}


	cout << ans;


    return 0;
}



Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    const s = arg.split("\n")[0].split("").sort().join("");
    const t = arg.split("\n")[1].split("").sort().reverse().join("");
    
    console.log(s < t ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 2e5+5;

ll n , ans;

ll solve(ll val)
{
    ll x = -1 + sqrt(1+4*2*val);
    x /= 2;
    return x;
}

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

    cin >> n;

    if (n%2==0)
    {
        ll c = 0;
        while(n%2==0)
        {
            c++ , n/=2;
        }
        ans += solve(c);
    }

    for(ll i=3; i*i<=n; i++)
    {
        if (n%i==0)
        {
            ll c=0;
            while(n%i==0)
            {
                c++ , n /= i;
            }
            ans += solve(c);
        }
    }
    if (n > 2) ans++;
    cout << ans << '\n';


    return 0;
}

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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
    int n,x;cin>>n>>x;
    vi vec(n);
    for(int i=0; i<n; ++i)
    	cin>>vec[i];
    vec.pb(1000000);
    int cnt=1;
    int k=0;
    for(int i=1; i<n+1; ++i)
    {	
    	int a = vec[i-1]+k;
    	//cout<<a<<"\n";
    	k=a;
    	if(a<=x)
    		++cnt;
    }
    cout<<cnt<<"\n";

}

Measured memory_bytes: 2944
a,b,c,d,e,f = map(int,input().split())
A =a* 100
B =b* 100
l = []
for i in range(f//A+1):
    for j in range(f//B+1):
        if i*A+j*B <=f:
            W = i*A+j*B
            s = (W//100)*e
            # print(s)
            r = f - W
            for I in range(s//c+1):
                for J in range(s//d+1):
                    if I*c + J*d<=s and I*c + J*d+W <= f and W>0:
                        S =I*c + J*d
                        l.append([100*S/(W+S),W+S,S])
l.sort()

l = l[::-1]
# print(l[:10])
print(l[0][1],l[0][2])

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

int main(){
  vector<vector<int>> mymap(3,vector<int>(3));
  for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      cin >> mymap.at(i).at(j);
    }
  }
  
  int n;
  cin >> n;
  for(int i = 0;i < n;i ++){
    int akeru;
    cin >> akeru;
    
  for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      if(mymap.at(i).at(j) == akeru)mymap.at(i).at(j) = 0;
      }
    }
  }
  
  int truee = 0;
  
  if(mymap.at(0).at(0) == truee && mymap.at(0).at(1) == truee && mymap.at(0).at(2) == truee)cout << "Yes" << endl;
  else if(mymap.at(1).at(0) == truee && mymap.at(1).at(1) == truee && mymap.at(1).at(2) == truee)cout << "Yes" << endl;
  else if(mymap.at(2).at(0) == truee && mymap.at(2).at(1) == truee && mymap.at(2).at(2) == truee)cout << "Yes" << endl;
  
  else if(mymap.at(0).at(0) == truee && mymap.at(1).at(0) == truee && mymap.at(2).at(0) == truee)cout << "Yes" << endl;
  else if(mymap.at(0).at(1) == truee && mymap.at(1).at(1) == truee && mymap.at(2).at(1) == truee)cout << "Yes" << endl;
  else if(mymap.at(0).at(2) == truee && mymap.at(1).at(2) == truee && mymap.at(2).at(2) == truee)cout << "Yes" << endl;

  else if(mymap.at(0).at(0) == truee && mymap.at(1).at(1) == truee && mymap.at(2).at(2) == truee)cout << "Yes" << endl;
  else if(mymap.at(0).at(2) == truee && mymap.at(1).at(1) == truee && mymap.at(2).at(0) == truee)cout << "Yes" << endl;
  
  else cout << "No" << endl;
  
  /*
  for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      cout << mymap.at(i).at(j) << endl;
    }
  }
  */
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    int A1,A2,A3; cin>>A1>>A2>>A3;
    cout<<(A1+A2+A3>=22 ? "bust" : "win")<<endl;
}

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

int main() {
	string s;
	cin >> s;
	int n = s.length();

	int g = 0;
	int p = 0;
	int score = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'g') {
			if (p < g) {
				score++;
				p++;
			}
			else {
				g++;
			}
		}
		else {
			if (p < g) {
				p++;
			}
			else {
				score--;
				g++;
			}
		}
	}
	cout << score << endl;
}

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

int main(void){
    int X, A, B;
    cin >> X >> A >> B;
    // implements
    if(B <= A){
        printf("delicious\n");
    }
    else if(B > (A+X)){
        printf("dangerous\n");
    }
    else{
        printf("safe\n");
    }

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
# print(n,m)
dparr=[[0,False] for i in range(n+1)]
b=[0 for i in range (n+1)]
adash=[0 for i in range(n+1)]
i=0
while(i<m):
	k=int(input())
	adash[k]=1
	i+=1
s=0
i=n
while(i>=0):
	if(adash[i]==1):
		b[i]=0
	else:
		if(i==n):
			b[i]=1
		elif(i==n-1):
			b[i]=1
		else:
			b[i]=(b[i+1]+b[i+2])%1000000007

	i-=1
print(b[0])

Measured memory_bytes: 18072
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


class UnionFind:
    def __init__(self,n):
        self.par = [i for i in range(n+1)]  # 親のノード番号
        self.rank = [0]*(n+1)
    def find(self,x):  # xの根のノード番号
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def same_check(self,x,y):  # x,yが同じグループか否か
        return self.find(x) == self.find(y)
    def unite(self,x,y):  # x,yの属するグループの併合
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            x,y = y,x
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1
        self.par[y] = x


N,M = MI()
edges = [tuple(MI()) for _ in range(M)]

ans = 0
for i in range(M):
    U = UnionFind(N)
    for j in range(M):
        if j != i:
            a,b = edges[j]
            U.unite(a,b)
    x,y = edges[i]
    if not U.same_check(x,y):
        ans += 1

print(ans)


Measured memory_bytes: 74412
#include <stdio.h>

int main()
{

    int a,b,c;
    int d=0;
    int x=0;
    scanf("%d %d %d",&a,&b,&c);
    
    for (x=a; x<=b; x++)
    {
        if (c%x==0)
            d++;
    }
    printf("%d\n",d);
    
    return 0;
    
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    for(int i=b-a+1;i<a+b;i++){
        cout << i<<" ";
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a, b, t, r;

  scanf("%d %d",&a, &b);
  if(a < b){
    t = a;
    a = b;
    b = t;
  }

  r = a % b;
  while(r != 0){
    a = b;
    b = r;
    r = a % b;
  }

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

  return 0;
}

Measured memory_bytes: 592
/**
 * Title:
 * Url:
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if((c-a-b)>0&4*a*b < (c-a-b)*(c-a-b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
	int R;

	scanf("%d", &R);
	
	if (R < 1200) {
		printf("ABC\n");
	}
	else if (R < 2800) {
		printf("ARC\n");
	}
	else {
		printf("AGC\n");
	}

	return 0;
}

Measured memory_bytes: 128
n = int(input())
k = [[0] * 10 for _ in range(10)]
for i in range(n + 1):
    l = int(str(i)[0])
    r = int(str(i)[-1])
    k[l][r] += 1
ans = 0

for i in range(1, 10):
    for j in range(1, 10):
        ans += k[i][j] * k[j][i]
print(ans)


Measured memory_bytes: 3060
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    BigInteger sum = BigInteger.ZERO;

    long a1 = sc.nextInt();
    for (int i = 1; i < n; i++) {
      long a2 = sc.nextLong();
      if (a1 > a2) {
        long x = a1 - a2;
        sum = sum.add(BigInteger.valueOf(x));
        a1 = a2 + x;
      } else {
        a1 = a2;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 48696
#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() {
  int n,k,a[1010],s=0;
  cin>>n>>k;
  
  rep(i,n) cin >> a[i];
  sort(a, a + n, greater<int>());
  
  rep(i,k){
    s+=a[n-1-i];
  }
  cout<<s<<endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, r;
	cin >> n >> r;
	if (n >= 10) {
		cout << r << endl;
		return 0;
	}
	else {
		int ans = r + 100 * (10 - n);
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
# UU  R     DD  L
#LUUU RR DR DDD LLU

sx, sy, tx, ty = map(int, input().split())
print('U'*abs(ty-sy),
        'R'*abs(tx-sx),
        'D'*abs(ty-sy),
        'L'*abs(tx-sx),
        'L',
        'U'*(abs(ty-sy)+1),
        'R'*(abs(tx-sx)+1),
        'DR',
        'D'*(abs(ty-sy)+1),
        'L'*(abs(tx-sx)+1),
        'U',
        sep='')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;

int main()
{
    int N;
    cin>>N;
    bool flag;
    int arr[N],B[N];
    for(int i=0; i<N; i++)
    {
        cin>>arr[i];
        B[i]=arr[i];
    }
    int n = sizeof(arr)/sizeof(arr[0]);
    sort(arr,arr+n);
    for(int i=0; i<N ; i++)
    {
        if(B[i]!=arr[N-1])
            cout<<arr[N-1]<<endl;
        else
            cout<<arr[N-2]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

ll A,B,C,k;

inline void file() {
	freopen("AGC024A.in","r",stdin);
	freopen("AGC024A.out","w",stdout);
}

int main() {
//	file();
	scanf("%lld%lld%lld%lld",&A,&B,&C,&k);
	if (k&1) printf("%lld",B-A);
	else printf("%lld",A-B);
	return 0;
}

Measured memory_bytes: 256
import sys
A,B,N=map(int,input().split())
X=B-1
ans=(A*N)//B-A*(N//B)
if B==1:
  print(0)
  sys.exit()
while X<=N:
  ans=max(ans,(A*X)//B-A*(X//B))
  X+=B
print(ans) 

Measured memory_bytes: 61792
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' && ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int Solve(int n, int k) {
  while (n % k != 0 && n > k) {
    int l = 0, r = 1e9, mid, ans;
    int cnt = n / k;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (cnt == (n - cnt * mid - mid) / k) l = mid + 1, ans = mid;
      else r = mid - 1;
    }
    n -= ans * cnt + ans;
    if (n % k != 0) n -= cnt + 1;
  }
  return n / k;
}

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n, ans = 0; read(n);
  for (RI i = 1, x, y; i <= n; ++i)
    read(x), read(y), ans ^= Solve(x, y);
  if (ans) puts("Takahashi");
  else puts("Aoki");

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

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

int main() {
    long long n, k, q;
    cin >> n >> k >> q;
    vector<long long> a(q);
    for(int i = 0; i < q; i++) {
        cin >> a.at(i);
        a.at(i)--;
    }
  
    vector<long long> win_num(n);
    for (int i = 0; i < q; i++) {
        win_num.at(a.at(i))++;
    }
    
    for (int i = 0; i < n; i++) {
        if(win_num.at(i) > q - k) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
}



Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;

int mod = 998244353;

int pre[305][305]; ///total open, total close
int cur[305][305];
signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	string S; cin >> S; int K; cin >> K;
	
	K = min(K, (int) S.length());
	reverse(S.begin(),S.end());
	
	vector<int> arr;
	
	int cnt = 0;
	for(char c : S){
		if(c == '0') arr.push_back(cnt), cnt = 0;
		else cnt++;
	}
	
	arr.push_back(0);
	int n = arr.size();
	
	
	
	pre[0][0] = 1;
	int total = 0;
	for(int i = 0;i < n;i++){
		total += arr[i];
		
		///open
		for(int c = 0;c <= total;c++){ 
			int acc = 0;
			for(int o = 0;o <= total;o++){
				acc += pre[o][c];
				acc %= mod;
				if(o > arr[i]) acc -= pre[o-arr[i]-1][c];
				acc %= mod;
				cur[o][c] += acc;
			}
		}
		
		///close
		for(int o = 0;o <= total;o++){
			int acc = 0;
			for(int c = 0;c <= o;c++){
				acc += pre[o][c];
				acc %= mod;
				cur[o][c] += acc;
			}
		}
		
		for(int o = 0;o <= total;o++){
			for(int c = 0;c <= total;c++){
				cur[o][c] -= pre[o][c];
			}
		}
		
		for(int o = 0;o <= total;o++){
			for(int c = 0;c <= total;c++){
				
				//cout << o << " " << c << " " << cur[o][c] << "\n";
				pre[o][c] = cur[o][c];
				pre[o][c] %= mod;
				if(pre[o][c] < 0) pre[o][c] += mod;
				cur[o][c] = 0;
			}
		}
		//cout << "\n\n";
	}
	
	//cout << K << "\n";
	int ans = 0;
	for(int i = 0;i <= K;i++){
		ans += pre[i][i];
		ans %= mod;
	}
	cout << ans;
}



Measured memory_bytes: 4848