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

void sort(int array[], const int size) {
	int i, last, sorted = size;

	while(sorted) {
		last = 0;
		for(i = 0; i < sorted - 1; ++i) {
			if(array[i] > array[i + 1]) {
				int temp = array[i];
				array[i] = array[i + 1];
				array[i + 1] = temp;

				last = i + 1;
			}
		}

		sorted = last;
	}
}

int main() {
	int pair;
	int three_card;
	int four_card;
	int straight;

	int flag;

	int continue_sum;
	int prev;
	int temp;

	int input[5];
	int i;

	while(scanf("%d", &input[0]) != EOF) {
		for(i = 1; i < 5; i++)
			scanf(",%d", &input[i]);

		pair = three_card = four_card = straight = flag = 0;
		prev = -1;

		sort(input, 5);

		for(i = 0; i < 5; i++) {
			if(prev == input[i]) {
				if(flag && three_card) {
					four_card++;
					three_card--;
				}

				else if (flag) {
					three_card++;
					pair--;
				}
				else
					pair++;

				flag = 1;
			}

			else if(input[i] - prev == 1) {
				straight++;
				flag = 0;
			}

			else
				flag = 0;

			prev = input[i];
		}

		if(pair == 2)
			printf("two pair\n");

		else if(pair == 1) {
			if(three_card)
				printf("full house\n");

			else
				printf("one pair\n");
		}

		else if(four_card)
			printf("four card\n");

		else if(three_card)
			printf("three card\n");

		else if(straight == 4)
			printf("straight\n");

		else if(straight == 3) {
			if(input[0] == 1 && input[4] == 13) {
				if(input[1] == 2 && input[3] != 12)
					printf("straight\n");
				else if(input[1] != 2 && input[3] == 12)
					printf("straight\n");
				else
					printf("null\n");
			}

			else printf("null\n");
		}

		else
			printf("null\n");
	}

	return 0;
}

Measured memory_bytes: 580
N,Q=map(int,input().split())
S=input()
A=[list(map(int,input().split())) for i in range(Q)]

X=[0]*(N)
cnt=0
for i in range(N-1): 
  if S[i]=='A' and S[i+1]=='C':
    cnt+=1
    X[i+1]=cnt
  else:
    X[i+1]=cnt
    
for i in range(Q):
  a=A[i][0]-1
  b=A[i][1]-1
  print(X[b]-X[a])

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

int main(){
  int x;
  cin >> x;
  int ans;
  for(int i=x; i<100010; ++i){
    bool sosu=true;
    for(int j=2; j<sqrt(i); ++j){
      if(i%j == 0) sosu=false;
    }
    if(sosu == true){
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
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")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;

fn main() {
    input!{n:usize, a:[i64;n]};
    println!("{}", if a.iter().filter(|&x| x%2==0&&(*x%3!=0&&*x%5!=0)).count() > 0 {"DENIED"} else {"APPROVED"});
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;

bool used[100003];
vector<ll> p;
ll cnt[100003];

constexpr ll MAX_N = 200003;
constexpr ll mod = 1e9 + 7;
ll fact[MAX_N], inv[MAX_N];

ll powm(ll x, ll p) {
	if (p == 0) return 1;
	ll res = powm(x, p / 2);
	res *= res;
	res %= mod;
	if (p % 2LL == 1) {
		res *= x;
		res %= mod;
	}
	return res;
}

void init_fact() {
	fact[0] = inv[0] = 1;
	for (ll i = 1; i < MAX_N; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= mod;
		inv[i] = powm(fact[i], mod - 2);
	}
}


int main() {
	init_fact();
	ll n, m; cin >> n >> m;

	for (ll i = 2; i <= 100000; i++) {
		if (used[i]) continue;
		ll pos = i;
		while (pos <= 100000) {
			used[pos] = true;
			pos += i;
		}

		if (m%i == 0) p.push_back(i);
		while (m%i == 0) {
			m /= i;
			cnt[i]++;
		}
	}

	ll ans = m > 1 ? n : 1;
	for (ll t : p) {
		ans *= (((fact[cnt[t] + n - 1] * inv[cnt[t]]) % mod)*inv[n - 1]) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[200000];
set<int> st;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		st.insert(a[i]);
	}
	if (n == (int)st.size())cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 11136
N,M=[int(x) for x in input().rstrip().split()]
l=[]
r=[]
for i in range(M):
    b=input().rstrip().split()
    l.append(int(b[0]))
    r.append(int(b[1]))

L=max(l)
R=min(r)

if R<L:
    print(0)
else:

    print(R-L+1)







Measured memory_bytes: 10996
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

INF = float('inf')

N, M = map(int, input().split())
adjL = [[] for _ in range(3*N)]
for _ in range(M):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    adjL[3*u+0].append(3*v+1)
    adjL[3*u+1].append(3*v+2)
    adjL[3*u+2].append(3*v+0)
S, T = map(int, input().split())
S, T = S-1, T-1

# 単一始点最短経路を求める（Dijkstra法）
def Dijkstra(adjList, vSt):
    numV = len(adjList)
    numUsed = 0
    costs = [INF] * numV
    costs[vSt] = 0
    PQ = []
    heappush(PQ, (0, vSt))
    while PQ:
        cNow, vNow = heappop(PQ)
        if cNow > costs[vNow]: continue
        numUsed += 1
        if numUsed == numV: break
        for v2 in adjList[vNow]:
            c2 = cNow + 1
            if c2 < costs[v2]:
                costs[v2] = c2
                heappush(PQ, (c2, v2))
    return costs

costs = Dijkstra(adjL, 3*S)
#print('costs:', costs)

if costs[3*T] == INF:
    print(-1)
else:
    print(costs[3*T]//3)


Measured memory_bytes: 60744
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	char s[11];
	int d[10];
	while(~scanf("%s",s)){
		rep(i,10)d[i]=s[i]-'0';
		rep(i,9)rep(j,9-i)d[j]=(d[j]+d[j+1])%10;
		printf("%d\n",*d);
	}
	return 0;
}

Measured memory_bytes: 1136
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vl a(n);
    vl b(n);
    ll ret = 0;
    vector<ll> aplusb(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        ret -= b[i];
        aplusb[i] = a[i] + b[i];
    }
    sort(aplusb.begin(), aplusb.end(), greater<ll>());
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            ret += aplusb[i];
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 2560
<?php
    fscanf(STDIN,"%d %d %d %d %d",$W,$H,$x,$y,$r);
    if (0 > $x-$r || $W < $x+$r || 0 > $y-$r || $H < $y+$r){
        echo 'No';
    }
    else{
        echo 'Yes';
    }
?>

Measured memory_bytes: 15216
from collections import defaultdict

s = int(input())
D = defaultdict(int)
D[s] += 1
ans = 1

def f(a):
  if a%2 == 0:
    return a//2
  else:
    return 3*a + 1

while True:
  s = f(s)
  ans += 1
  if D[s] == 1:
    print(ans)
    break
  D[s] += 1

Measured memory_bytes: 9444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n = 1e5;
ll v[max_n];//m,a,r,c,h
int n;
void solve(){
  ll sum = 0;
  for(int i=0 ; i<5 ; i++){
    for(int j=i+1 ; j<5 ; j++){
      for(int k=j+1 ; k<5 ; k++){
        sum += v[i]*v[j]*v[k];
      }
    }
  }
  cout << sum << endl;
}

int main(){
  cin >> n;
  for(int i=0 ; i<n ; i++){
    char s[10];
    scanf("%s", s);
    if(s[0] == 'M')v[0]++;
    if(s[0] == 'A')v[1]++;
    if(s[0] == 'R')v[2]++;
    if(s[0] == 'C')v[3]++;
    if(s[0] == 'H')v[4]++;
  }
  sort(v, v+5);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
typedef long long ll;
using namespace std;
int main(void){
  ll aval,bval,abval,a,b,c,d;
  cin >> aval >> bval >> abval >>a >>b;
  c = max(a,b);
  d = min(a,b);
  if(2*abval>aval+bval){
    ll ans = aval*a+bval*b;
    cout << ans;
  }else if(a>b){
    if(2*abval>aval){
      ll ans = 2*abval*d+(c-d)*aval;
      cout << ans;
    }else{
      ll ans = 2*abval*d+(c-d)*2*abval;
      cout << ans;
    }
  }else{
     if(2*abval>bval){
      ll ans = 2*abval*d+(c-d)*bval;
      cout << ans;
    }else{
      ll ans = 2*abval*d+(c-d)*2*abval;
      cout << ans;
    }
  }
  
  return 0;            
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl '\n'
#define TIME 1.0*clock()/CLOCKS_PER_SEC
#define pii pair < int , int >
#define Endl '\n'

#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

template <typename T> using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 gen(chrono::system_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const int FFTM = 998244353;

const int SX[4] = {0 , 1 , -1 , 0};
const int SY[4] = {1 , 0 , 0 , -1};
const int rx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int ry[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const int kx[8] = {1, 1, -1, -1, 2, 2, -2, -2};
const int ky[8] = {2, -2, 2, -2, 1, -1, 1, -1};

typedef cc_hash_table< int, int, hash<int>, equal_to<int>, direct_mask_range_hashing<int>, hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("gotham.in", "r", stdin);
//    freopen("gotham.out", "w", stdout);
#endif
    int x;
    cin >> x;
    int kol = 8, rt = 599;
    while(x > rt)kol--, rt += 200;
    cout << kol << endl;
    return 0;
}



Measured memory_bytes: 3652
import math
l=int(input())
n=int(math.log2(l)+1)
E=[]
for i in range(n-1):
    E.append([i+1,i+2,0])
    E.append([i+1,i+2,2**i])
i=n-2
while l>2**(n-1):
    t=l-2**i
    if t>2**(n-1)-1:
        E.append([i+1,n,t])
        l=t
    i-=1
print(n,len(E))
for i in range(len(E)):
    print(*E[i])


Measured memory_bytes: 3064
function main(input) {
	const abcd = input.trim().split("").map(n => Number(n));
  	let result = "";
  	for (let i = 0; i < 8; i++) {
    	let strI = i.toString(2);
      	strI = Array(3-strI.length).fill("0").join("") + strI;
      	let total = abcd[0];
      	let ops = "";
      	for (let j = 0; j < strI.length; j++) {
        	if (strI[j] === "0") {
              	total += abcd[j + 1];
              	ops = ops + "+";
            } else {
              	total -= abcd[j + 1];
              	ops = ops + "-";
            }
        }
      	if (total === 7) {
          	result = abcd[0] + ops[0] + abcd[1] + ops[1] + abcd[2] + ops[2] + abcd[3] + "=7";
          	break;
        }
    }
  	console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

loop do
  n=gets.to_i
  break if n.zero?
  rank=array(n,1)
  part=array(10**3+1,1)
  excellence=array(10**3+1,1,0)
  all=0
  n.times do|i|
    l,u,a,p=get_i 
    rank[i]=[l,a,p]
    part[l]=u
  end
  rank.sort!{|x,y| x[0]<=>y[0]}
  rank.sort!{|x,y| x[2]<=>y[2]}
  rank.sort!{|x,y| y[1]<=>x[1]}
  
  i=0
  ans=[]
  while all<26  and i<n
    if all<10
      if excellence[part[rank[i][0]]]<3
        excellence[part[rank[i][0]]]+=1
        all+=1
        ans.push(rank[i][0])
      end
    elsif all<20
      if excellence[part[rank[i][0]]]<2
        excellence[part[rank[i][0]]]+=1
        all+=1
        ans.push(rank[i][0])
      end
    else
      if excellence[part[rank[i][0]]].zero?
        excellence[part[rank[i][0]]]+=1
        all+=1
        ans.push(rank[i][0])
      end
    end
    i+=1
  end
  puts ans.join("\n")
end


Measured memory_bytes: 6952
import java.io.PrintWriter;
import java.util.*;

public class Main {

    private static final int[] DX = {0, 1, 0, -1}, DY = {1, 0, -1, 0};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int w = in.nextInt(), h = in.nextInt();
        while (w > 0) {
            boolean[][][][] dist = new boolean[h][w][h][w];

            int lsx = -1, lsy = -1, rsx = -1, rsy = -1;
            int lgx = -1, lgy = -1, rgx = -1, rgy = -1;
            String[] lb = new String[h], rb = new String[h];
            for (int i = 0; i < h; i++) {
                lb[i] = in.next();
                rb[i] = new StringBuilder(in.next()).reverse().toString();
                for (int j = 0; j < w; j++) {
                    if (lb[i].charAt(j) == 'L') {
                        lsx = j;
                        lsy = i;
                    } else if (lb[i].charAt(j) == '%') {
                        lgx = j;
                        lgy = i;
                    }
                    if (rb[i].charAt(j) == 'R') {
                        rsx = j;
                        rsy = i;
                    } else if (rb[i].charAt(j) == '%') {
                        rgx = j;
                        rgy = i;
                    }
                }
            }
            if (lsx == -1 || rsx == -1) throw new RuntimeException();

            Queue<Node> q = new ArrayDeque<>();
            dist[lsy][lsx][rsy][rsx] = true;
            q.offer(new Node(lsx, lsy, rsx, rsy));
            while (!q.isEmpty()) {
                Node node = q.poll();
                for (int i = 0; i < 4; i++) {
                    int nlx = node.lx + DX[i], nly = node.ly + DY[i];
                    int nrx = node.rx + DX[i], nry = node.ry + DY[i];
                    if (nlx < 0 || nly < 0 || nlx >= w || nly >= h || lb[nly].charAt(nlx) == '#') {
                        nlx = node.lx;
                        nly = node.ly;
                    }
                    if (nrx < 0 || nry < 0 || nrx >= w || nry >= h || rb[nry].charAt(nrx) == '#') {
                        nrx = node.rx;
                        nry = node.ry;
                    }
                    if ((nlx == lgx && nly == lgy) != (nrx == rgx && nry == rgy)) continue;
                    if (dist[nly][nlx][nry][nrx]) continue;
                    dist[nly][nlx][nry][nrx] = true;
                    q.offer(new Node(nlx, nly, nrx, nry));
                }
            }

            out.println(dist[lgy][lgx][rgy][rgx] ? "Yes" : "No");
            w = in.nextInt();
            h = in.nextInt();
        }

        out.flush();
    }

    static class Node {
        int lx, ly;
        int rx, ry;

        Node(int lx, int ly, int rx, int ry) {
            this.lx = lx;
            this.ly = ly;
            this.rx = rx;
            this.ry = ry;
        }
    }
}



Measured memory_bytes: 186952
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define ushi int
#define tapu main
#define nichia (
#define kunn void
#define wara )

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main(){

	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", (a - b) % c);

	Please AC;
}


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

int main () {

    ll X; cin >> X;

    ll start = 100;

    int i = 0;
    while(start < X) {
        i++;
        start += (ll) start*0.01;
    }

    cout << i << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b=1;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>a;
    if(a%2==0)b*=2;
  }
  cout << pow(3,n)-b << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:108777216")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <utility>
#include <algorithm>
#include <ctime>
using namespace std;

int s[100000];
long long ms[1024 * 1024], new_ms[1024 * 1024];

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	int n, k;
	scanf("%d%d", &n,&k);
	for (int i = 0; i < n; i++)
		scanf("%d", &s[i]);

	long long mx = 0;
	int ms_len = 0;
	for (int i = 0; i < n; i++) {
		long long sum = 0;
		for (int j = i; j < n; j++) {
			sum += s[j];
			ms[ms_len++] = sum;
		}
	}

	sort(ms, ms + ms_len);

	long long ans = 0;

	for (int j = 60; j >= 0; j--) {
		int cnt = 0;
		for (int i = 0; i < ms_len; i++)
			if ((ms[i] >> j) & 1)
				cnt++;
		if (cnt >= k) {
			ans += (1LL << ((long long) j));
			int new_ms_len = 0;
			for (int i = 0; i < ms_len; i++)
				if ((ms[i] >> j) & 1)
					new_ms[new_ms_len++] = ms[i];
			ms_len = new_ms_len;
			for (int i = 0; i < ms_len; i++) ms[i] = new_ms[i];
		}
	}

	cout << ans;
	return 0;
}

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

typedef long long int in; 

in dp[1005][1005],a[1005][1005];

int main() 
{
    in n,m,i,j,ans=0,l=1000000007;
    cin>>n>>m;
    
    char b[n+5][m+5];
    
    for(i=1;i<=n;++i)
    for(j=1;j<=m;++j)
    cin>>b[i][j];
    
    for(i=1;i<=n;++i)
    {
        in r=1;
        
        for(j=1;j<=m;++j)
        {
            if(b[i][j]=='.'&&r)
            a[i][j]=1;
            else
            {
                a[i][j]=0;
                r=0;
            }
        }
    }
    
    for(i=1;i<=m;++i)
    {
        in r=1;
        
        for(j=1;j<=n;++j)
        {
            if(b[j][i]=='.'&&r&&a[j][i])
            a[j][i]=1;
            else
            {
                a[j][i]=0;
                r=0;
            }
        }
    }
    
    // for(i=1;i<=n;++i)
    // {
    //     for(j=1;j<=m;++j)
    //     cout<<a[i][j]<<" ";
    //     cout<<"\n";
    // }
    
    for(i=1;i<=n;++i)
    dp[1][i]=a[1][i];
    
    for(i=1;i<=m;++i)
    dp[i][1]=a[i][1];
    
    for(i=2;i<=n;++i)
    for(j=2;j<=m;++j)
    if(b[i][j]!='#')
    {
        if(b[i][j-1]!='#')
        dp[i][j]=(dp[i][j]+dp[i][j-1])%l;
        if(b[i-1][j]!='#')
        dp[i][j]=(dp[i][j]+dp[i-1][j])%l;
    }
    
    // for(i=1;i<=n;++i)
    // {
    //     for(j=1;j<=m;++j)
    //     cout<<dp[i][j]<<" ";
    //     cout<<"\n";
    // }
    
    cout<<dp[n][m];
    
	return 0;
}

Measured memory_bytes: 17024
l=list(input())
plmi = [0 for i in range(3)] #プラマイ
for i in range(1 << 3):
    p=int(l[0])
    for j in range(3):
        if (i >> j) & 1:
            p+=int(l[j+1])
            plmi[j]='+'
        else:
            p-=int(l[j+1])
            plmi[j]='-'
    if p==7:
        print(l[0]+plmi[0]+l[1]+plmi[1]+l[2]+plmi[2]+l[3]+'=7')
        break

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

int main(){
    long N,M;
    long x,y;
    long count=0;
    long N_ball[100002]={};
    double prob_red[100002]={};

    cin >> N >> M;
    for(long i=1;i<=N;i++){
        N_ball[i] = 1;
    }
    prob_red[1] = 1;

    for(long i=1;i<=M;i++){
        cin >> x >> y;
        prob_red[y] += prob_red[x]/(double)N_ball[x]; 
        prob_red[x] -= prob_red[x]/(double)N_ball[x];
        N_ball[x]--;
        N_ball[y]++;
        if(prob_red[x]!=0 && prob_red[x]<0.001) prob_red[x]=0.001;
        if(prob_red[y]!=0 && prob_red[y]<0.001) prob_red[y]=0.001;
    }

    for(long i=1;i<=N;i++){
        if(fabs(prob_red[i])>=1e-15) count++;
    }
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 1792
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, m = MAP()
a = [STR() for _ in range(n)]
b = [STR() for _ in range(m)]
for i in range(n - m + 1):
    for j in range(n - m + 1):
        flag = True
        for k in range(m):
            for l in range(m):
                if a[i + k][j + l] != b[k][l]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print('Yes')
            exit()
print('No')

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

int main() {
    ll N, K; cin >> N >> K;
    vector<ll> A(N+1); 
    for (int i = 1; i <= N; i++) cin >> A[i];
    
    vector<int> tp(N+1);
    tp[0] = 1;
    
    vector<int> visited(N+1, -1);
    visited[1] = 0;

    ll cycle = 0;
    ll first = 0;
    for (ll i = 1; i <= N; i++) {
        tp[i] = A[tp[i-1]];
        if (visited[tp[i]] != -1) {
            first = visited[tp[i]];
            cycle = i - visited[tp[i]];
            break;
        } else {
            visited[tp[i]] = i;
        }
    }
    ll n;
    if (K > first) n = ((K - first) % cycle) + first;
    else n = K;
    cout << tp[n] << endl;
}


Measured memory_bytes: 6428
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

S = input()
Xans,Yans = inpl()

Xmove = []
Ymove = []

First = True
flag = True
tmp = 0
for s in S+'T':
	if s == 'F':
		tmp += 1
	else:
		if First:
			Xans -= tmp
			First = False
		else:
			if flag:
				Xmove.append(tmp)
			else:
				Ymove.append(tmp)
		tmp = 0
		flag = not flag


Xsum = sum(Xmove)
if (Xsum+Xans)%2 == 1:
	print('No')
	sys.exit()
elif abs(Xans) > Xsum:
	print('No')
	sys.exit()
elif len(Xmove) == 0:
	if Xans != 0:
		print('No')
		sys.exit()
else:
	Xpos = (Xsum+Xans)//2
	dp = [0]*(Xpos+1)
	dp[0] = 1
	for x in Xmove:
		for i in range(Xpos,x-1,-1):
			dp[i] = dp[i-x]
		if dp[-1] == 1:
			break
	else:
		print('No')
		sys.exit()

Ysum = sum(Ymove)
if (Ysum+Yans)%2 == 1:
	print('No')
	sys.exit()
elif abs(Yans) > Ysum:
	print('No')
	sys.exit()
elif len(Ymove) == 0:
	if Yans != 0:
		print('No')
		sys.exit()
else:
	Ypos = (Ysum+Yans)//2
	dp = [0]*(Ypos+1)
	dp[0] = 1
	for y in Ymove:
		for i in range(Ypos,y-1,-1):
			dp[i] = dp[i-y]
		if dp[-1] == 1:
			break
	else:
		print('No')
		sys.exit()

print('Yes')


Measured memory_bytes: 4852
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか

int main() {
	int dp[200030] = {};
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		dp[a]++;
	}
	vector<int>s;
	for (int i = 0; i <= 200000; i++) {
		if (dp[i] != 0) {
			s.push_back(dp[i]);
		}
	}
	long long int sum = 0;
	sort(s.begin(), s.end(), greater<int>());
	for (int i = 0; i < k; i++) {
		sum = s[i] + sum;

		if (i == s.size()-1) {
			break;
		}
	}
	cout << n - sum;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/07/29  Problem: ARC 079 A / Link: http://arc079.contest.atcoder.jp/tasks/arc079_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

ll N;
vector<int>G[200010];
ll ans = 0LL;

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	ll M;
	cin >> N>>M;
	FOR(i, 0, M) {
		int a, b; cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	FOR(i, 0, G[1].size()) {
		int v = G[1][i];
		FOR(j, 0, G[v].size()) {
			if (G[v][j] == N) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
	}
	cout <<"IMPOSSIBLE" << endl;

	return 0;
}


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

int dp[110][5][2];

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s;
	int kk;
	cin >> s >> kk;
	int n = s.size();
	dp[0][0][0] = 1;
	rep(i, 0, n){
		rep(j, 0, kk + 1){
			if(s[i] == '0') dp[i + 1][j][0] += dp[i][j][0];
			else dp[i + 1][j][1] += dp[i][j][0];
			dp[i + 1][j][1] += dp[i][j][1];
			rep(k, 1, 10){
				if(s[i] == '0' + k) dp[i + 1][j + 1][0] += dp[i][j][0];
				else if(s[i] > '0' + k) dp[i + 1][j + 1][1] += dp[i][j][0];
				dp[i + 1][j + 1][1] += dp[i][j][1];
			}
		}
	}
	cout << dp[n][kk][0] + dp[n][kk][1] << endl;
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define np next_permutation
#define bs binary_search
#define mp make_pair
#define all(x) x.begin(), x.end()
#define bp __builtin_popcountll
#define sqr(x) ((llong)sqrt (x))
#define b_ctz __builtin_ctzll
#define b_clz __builtin_clzll

#define y1 road_to_respa_top_6
#define prev road_to_respa_top_6
#define Abdrakhman abcdefghijklmnopqrstuvwxyzRakhman
#define left kotoriy_levee_chem_right
#define right kotoriy_pravee_chem_left

#define android ios_base::sync_with_stdio(0), cin.tie (0), cout.tie (0)
#define fn ""

typedef long long llong;
typedef long double ldouble;
typedef unsigned long long ullong;

typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <vector <llong> > matrix;

typedef pair <llong, llong> pll;

typedef map <int, int> mii;

typedef set <llong> sl;

const int MXN = 1e6 + 1;
const llong MNN = 1e3 + 1;
const llong MOD = 1e9 + 7;
const int INF = 1e9;
const llong LINF = 1e18;
const llong MAGIC = 1000;
const ldouble EPS = 1e-9;
const ldouble PI = 3.1415926536;
const string TIME = "rovno_ushten_push_ketti";

inline llong log2 (llong x) {return 64 - b_clz (x) - 1;};
inline llong __lcm (llong a, llong b) {return a / __gcd (a, b) * b;}

int n, cnt;
int a[MXN];

int main () {
    android;
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= 2 * n; i ++) cin >> a[i];
    sort (a + 1, a + n + n + 1);
    for (int i = 1; i <= 2 * n; i += 2) {
        cnt += min (a[i], a[i + 1]);
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
def calc_a(x):
    if x%2 == 0:
        y = x//2
    else:
        y = 3*x+1
    return y


s = int(input())
a = [s]

i=1
while i<100000:
    ai = calc_a(a[i-1])
    if ai in a:
        # print(a.index(ai))
        print(i+1)
        a.append(ai)
        break
    else:
        a.append(ai)
    i+=1
# print(a)



Measured memory_bytes: 38256
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

#define SWAP(a, b) a = a ^ b; b = a ^ b; a = a ^ b

void swap(int * a, int * b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}

void print_int(int n)
{
    printf("%d\n",n);
    
}

void sort(int a[], int n)
{
    int h, i, j;

    for(h = 1; h < n / 9; h = h * 3 + 1)
        continue;

    for(; h > 0; h /= 3)
    {
        for(i = h; i < n; i++)
        {
            j = i;
            while(j >= h && a[j] < a[j-h])
            {
                swap(&a[j], &a[j-h]);
                j -= h;
            }
        }
    }
}

void print_list(int a[], int n)
{
    for(int i = 0; i < n; i++)
    {
        printf("%d ", a[i]);
    }
}

void intcpy(int a[], const int b[], int count)
{
    for(int i = 0; i < count; i++)
    {
        a[i] = b[i];
    }
}

int list_sum(int a[], int n)
{
    int sum = 0;

    for(int i = 0; i < n; i++)
    {
        sum += a[i];
    }

    return sum;
}


void permutate(int s[], int count, int n)
{
    if(n == count)
        return;

    for(int i = n; i < count; i++)
    {
        swap(&s[i], &s[n]);

        if(i != n)
        {
            //intcpy(result[j++], s, count);
        }
        
        permutate(s, count, n+1);
        swap(&s[i], &s[n]);
    }
}



int main(void)
{
    int n, s, k = 0, ans = 0;
    scanf("%d", &n);
    int n2 = n;
    for (int i = n; i > 0; i /= 10)
    {
        ans += i % 10;
        n -= i % 10;
    }
    if(n2 % ans == 0)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    
    
    
    return 0;
}



Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {if (a > b) a = b;}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {if (a < b) a = b;}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 10050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;

int cnt[10000010];
void solve() {
	int N; cin >> N;
	FOR(i, 1, N + 1) {
		for (int j = i; j <= N; j += i) {
			cnt[j]++;
		}
	}
	ll ans = 0;
	FOR(k, 1, N + 1) {
		ans += k * cnt[k];
	}
	print(ans);
}

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

	 //int q;
	 //cin >> q;
	 //while (q--)
	solve();
}


Measured memory_bytes: 81724
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    ll s{},m=LLONG_MAX;
    in>>n;
    vector<ll> a(n);
    for(auto&i:a) in>>i,s+=i,m=min(m,i);
    if(n&1) return puts(s%2?"First":"Second"),0;
    if(m&1) return puts("First"),0;
    puts(s%2?"First":"Second");
}


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

int main() {
    int n, m; std::cin >> n >> m;
    for (int i = 0; i < m + 2; i++) std::cout << '#';
    std::cout << std::endl;
    for (int i = 0; i < n; i++) {
        std::string s; std::cin >> s;
        std::cout << '#' << s << '#' << std::endl;
    }
    for (int i = 0; i < m + 2; i++) std::cout << '#';
    std::cout << std::endl;
}



Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
x, y = tx - sx, ty - sy
if x > 0 and y > 0:
  u, d, l, r = "UDLR"
else:
  u, d, l, r = "UDLR"
p = ""
p += u * y
p += r * x
p += d * y
p += l * x
p += l
p += u * (y + 1)
p += r * (x + 1)
p += d
p += r
p += d * (y + 1)
p += l * (x + 1)
p += u
print(p)

Measured memory_bytes: 3064
let () =
  let i = read_line () in
  let a,b,c = Scanf.sscanf i "%d %d %d" (fun a b c ->  a,b,c) in
  let rec aux i count =
    if i > b then string_of_int count
    else aux (i+1) (if c mod i = 0 then count+1 else count)
  in
  print_endline (aux a 0)

Measured memory_bytes: 2380
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    ll N; cin >>N;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);

    map<ll, ll> cnt;
    set<ll> s;
  
  	s.insert(0);
  	cnt[0] = 1;
    
    ll sum = 0;
    rep(i, N){
        sum += A.at(i);
        if(s.count(sum)){
            cnt.at(sum)++;
        }
        else{
            s.insert(sum);
            cnt[sum] = 1;
        }
    }

    ll ans = 0;
    for(auto value : s){
        ll n = cnt[value];
        ans += n*(n-1)/2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


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

  int N;
  cin >> N;
  int A[N];
  rep(i, N) cin >> A[i];
  
  int ans = 1;
  int X = 0, Y = 0, Z = 0;
  for(int i=0;i<N;i++){
    if(A[i] == X){
      if(X == Y && X == Z){
        ans *= 3;
        ans %= MOD;
      }
      else if(X == Y || X == Z){
        ans *= 2;
        ans %= MOD;
      }
      X++;
    }
    else if(A[i] == Y){
      if(Y == Z){
        ans *= 2;
        ans %= MOD;
      }
      Y++;
    }
    else if (A[i] == Z){
      Z++;
    }
    else{
      cout << 0 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}

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

vector<int> a(1100);
vector<int> xs(4100);
vector<int> ys(4100);

vector<pair<int,int>> f(vector<int> v){
    if(v.size()==4){
        vector<pair<int,int>> res = {{0,0},{1,0},{1,1},{0,1}};
        return res;
    }
    int n=v.size();
    for(int i=0; i<n; i++){
        if(v[i]==90 && v[(i+1)%n]==270){
            vector<int> to;
            to.push_back(v[(i+n-1)%n]);
            for(int j=2; j<n-1; j++) to.push_back(v[(i+j)%n]);
            vector<pair<int,int>> tmp=f(to);
            for(int j=0; j<tmp.size(); j++) tmp[j].first<<=1,tmp[j].second<<=1;
            while(1){
                if(tmp[0].first>tmp[1].first) break;
                for(int j=0; j<tmp.size(); j++){
                    int tx=1000-tmp[j].second;
                    int ty=tmp[j].first;
                    tmp[j]={tx,ty};
                }
            }
            tmp.resize(tmp.size()+2);
            for(int j=tmp.size()-1; j>=2; j--) tmp[j]=tmp[j-2];
            tmp[0]=tmp[1]=tmp[2];
            tmp[1].first--;
            tmp[2].first--;
            tmp[2].second--;
            tmp[3].second--;
            for(int j=0; j<tmp.size(); j++){
                xs[j]=tmp[j].first;
                ys[j]=tmp[j].second;
            }
            sort(xs.begin(),xs.begin()+tmp.size());
            sort(ys.begin(),ys.begin()+tmp.size());
            for(int j=0; j<tmp.size(); j++){
                tmp[j].first=upper_bound(xs.begin(),xs.begin()+tmp.size(),tmp[j].first)-xs.begin();
                tmp[j].second=upper_bound(ys.begin(),ys.begin()+tmp.size(),tmp[j].second)-ys.begin();
            }
            vector<pair<int,int>> res(n);
            for(int j=0; j<n; j++) res[(i+n-1+j)%n]=tmp[j];
            return res;
        }
    }
    return vector<pair<int,int>> ();
}

int main()
{
    int n;
    cin >> n;
    int k=0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i]==90) k++;
        else k--;
    }
    if(k!=4){
        cout << -1 << "\n";
        return 0;
    }
    vector<int> v;
    for(int i=0; i<n; i++) v.push_back(a[i]);
    vector<pair<int,int>> ans = f(v);
    for(auto it: ans) cout << it.first << " " << it.second << "\n";
    return 0;
}


Measured memory_bytes: 2688
N = int(input())
H = list(map(int, input().split()))

ans = 0
count = 0

for i in range(1, N):
    if H[i] <= H[i - 1]:
        count += 1
        ans = max(ans, count)
    else:
        ans = max(ans, count)
        count = 0
    
print(ans)

Measured memory_bytes: 14252
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n,c;
vi num,tmp;

void func(){
	c++;
	for(int i=0;i<n;i++){
		int x=0;
		for(int j=0;j<n;j++){
			if(num[i]==num[j]) x++;
		}
		tmp[i]=x;
	}
}

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		num=vi(n);
		tmp=vi(n);
		for(int i=0;i<n;i++) cin>>num[i];
		c=0;
		while(1){
			func();
			int ctmp=0;
			for(int i=0;i<n;i++){
				if(num[i]==tmp[i]) ctmp++;
			}
			if(ctmp==n) break;
			for(int i=0;i<n;i++) num[i]=tmp[i];
		}
		cout<<c-1<<endl;
		for(int i=0;i<n-1;i++) cout<<num[i]<<' ';
		cout<<num[n-1]<<endl;
	}
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define int long long int
std::vector<int> v[1002];


int32_t main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","rb",stdin);
    // #endif
int a,b,c;
cin >> a >> b >> c;
cout << min(b/a,c);
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;




int main() {
	string s;
	cin >> s;
	int ans = 0;

	int n = s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] == '+')ans++;
		else ans--;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
c = str(input())

for i in range(len(alpha)):
    if alpha[i] == c:
        print(alpha[i+1])

Measured memory_bytes: 3064