akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef pair<int, P> P2;
typedef pair<int, P2> P3;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;
struct edge {
	ll from, to, cost;
};

int n, m, x;
vector<P>es[20005];
int t[10005] = { 0 };
int dp[10005][3][205] = { 0 };

int main() {
	cin >> n >> m >> x;
	rep(i, n) cin >> t[i];
	rep(i, m) {
		int a, b, d;
		cin >> a >> b >> d;
		a--; b--;
		es[a].pb(P(b, d));
		es[b].pb(P(a, d));
	}
	rep(i, n) {
		rep(j, 3) {
			rep(k, 205) {
				dp[i][j][k] = INF;
			}
		}
	}
	dp[0][0][0] = 0;
	priority_queue<P3, vector<P3>, greater<P3>> que;
	que.push(P3(0, P2(0, P(0, 0))));
	while (!que.empty()) {
		P3 p3 = que.top();
		que.pop();
		int nc = p3.first;
		P2 p2 = p3.second;
		int v = p2.first;
		P p = p2.second;
		int lt = p.first;
		int td = p.second;
		if (nc > dp[v][lt][td]) continue;
		for (int u = 0; u < es[v].size(); u++) {
			int to = es[v][u].first;
			int cost = es[v][u].second;
			int tmp = dp[v][lt][td] + cost;
			if (t[to] == 1) {
				int ntd = td + cost;
				if (td + cost > x) {
					ntd = x;
				}
				if (dp[to][lt][ntd] > tmp) {
					dp[to][lt][ntd] = tmp;
					que.push(P3(tmp, P2(to, P(lt, ntd))));
				}
			}
			if (t[to] == 0) {
				if (lt == 0) {
					if (dp[to][0][0] > tmp) {
						dp[to][0][0] = tmp;
						que.push(P3(tmp, P2(to, P(0, 0))));
					}
				}
				else {
					if (td + cost >= x) {
						if (dp[to][0][0] > tmp) {
							dp[to][0][0] = tmp;
							que.push(P3(tmp, P2(to, P(0, 0))));
						}
					}
				}
			}
			if (t[to] == 2) {
				if (lt == 2) {
					if (dp[to][2][0] > tmp) {
						dp[to][2][0] = tmp;
						que.push(P3(tmp, P2(to, P(2, 0))));
					}
				}
				else {
					if (td + cost >= x) {
						if (dp[to][2][0] > tmp) {
							dp[to][2][0] = tmp;
							que.push(P3(tmp, P2(to, P(2, 0))));
						}
					}
				}
			}
		}
	}
	int res = INF;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j <= x; j++) {
			res = min(res, dp[n - 1][i][j]);
		}
	}
	cout << res << endl;
	return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  llong N, M;
  vector<llong> A;

  cin >> N >> M;
  A.resize(N);
  llong res = 1;
  llong beki = -1;
  for (auto &in: A) {
    cin >> in;
    llong cnt = 0, cp = in;
    while (cp % 2 == 0) {
      ++cnt;
      cp /= 2;
    }
    if (beki == -1) {
      beki = cnt;
    }
    else if (beki != cnt) {
      beki = -1;
      break;
    }

    res = res / __gcd(res, in / 2) * in / 2;
  }
  cerr << res << " " << beki << endl;

  llong ans = M / res;
  ans = ans / 2 + ans % 2;
  cout << (beki == -1 ? 0 : ans) << endl;

  return 0;
}

Measured memory_bytes: 1024
fn main() {
    let n: u64 = read();
    let v: Vec<Vec<i32>> = read_vec2(n);
    let mut ans = 0.0;
    for i in 0..n {
        for j in 0..n {
            if i != j {
                let a = v[i as usize][0];
                let b = v[i as usize][1];
                let c = v[j as usize][0];
                let d = v[j as usize][1];
                ans += (((a - c) * (a - c) + (b - d) * (b - d)) as f64).sqrt()
            }
        }
    }
    ans /= n as f64;
    println!("{}", ans);
}








//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


Measured memory_bytes: 4352
void main()
{
    long n = rdElem;

    double total = 0.0;
    foreach (i; 0 .. n)
    {
        double x;
        string u;
        rdVals(x, u);
        if (u == "BTC") x *= 380000.0;
        total += x;
    }

    writefln("%.8f", total);
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n;
	string x;
	cin >> n >> x;
	VV tri(n, V(3, INFLL));  //+1,turnal, -1 on mod each posit;
	int mod = 0;
	rep(i, n) { mod += (x[i] == '1'); }
//	clog <<"mod:"<< mod << endl;
	rep(j, 3) {
		if (mod - j + 1 <= 0) continue;
		rrep(i, n) {
			if (i == n - 1) {
				tri[i][j] = 1LL % (mod - j + 1);
			} else {
				tri[i][j] = tri[i + 1][j] * 2LL;
				tri[i][j] %= (mod - j + 1);
			}
		}
	}
	ll up     = 0LL;
	ll down   = 0LL;
	rep(i,n){
		if(x[i]=='1'){
			up += tri[i][0];
			down += tri[i][2];
		}
	}
	ll cnt = 0LL;
	int count = 0;
	int id;
	rep(i,n){
		cnt   = 0LL;
		count = 0LL;
		
		
		
		if((mod==1)and x[i]=='1'){
			cout << 0 << endl;
			continue;
		}
		if(x[i]=='1'){
			cnt = down;
			cnt -= tri[i][2];
		}else{
			cnt = up;
			cnt += tri[i][0];
		}
		cnt %= (x[i]=='0' ? mod + 1 : mod - 1);
		count = 1;
		//clog << cnt << endl;
		while(cnt!=0LL){
			count++;
			cnt %= __builtin_popcount(cnt);
		//	clog << count << " " << cnt << endl;
		}
		cout << count << endl;
		//clog << "---" << endl;
	}
	//clog << tri << endl;
}

Measured memory_bytes: 14440
def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()
    
    n = int(input())
    red = [tuple(map(int, input().split())) for _ in range(n)]
    blue = [tuple(map(int, input().split())) for _ in range(n)]

    red.sort()
    blue.sort()

    now = 0
    for i in blue:
        while now < len(red) and red[now] < i:
            now += 1
        
        l = red[:now]
        if l == []:
            continue

        l = sorted(l, key=lambda x: x[1])
        for j in range(len(l)-1, -1, -1):
            if l[j][1] < i[1]:
                red.remove(l[j])
                now -= 1
                break

    print(n - len(red))

main()

Measured memory_bytes: 63908
use std::io;


fn main() {
    let (n, k) = {
        let i = read::<usize>();
        (i[0], i[1] as isize)
    };

    let mut an = Vec::new();
    for _ in 0..n { an.push(read_one::<isize>() - k); }

    // cumsum
    let mut bn = vec![0; n];
    bn[0] = an[0];
    for i in 1..n { bn[i] = bn[i - 1] + an[i]; }

    // compress
    let mut bn_s = bn.clone();
    bn_s.sort();
    bn_s.dedup();

    let cn = bn.iter()
        .map(|b| bn_s.binary_search(b).unwrap())
        .collect::<Vec<usize>>();

    let mut bit = FenwickTree::new(bn_s.len());
    // append {single} >= K elements
    let mut ans = bn.into_iter().filter(|&b| b >= 0).count();

    for c in cn {
        ans += bit.sum(c + 1);
        bit.add(c, 1);
    }

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


#[derive(Debug)]
struct FenwickTree {
    n: usize,
    bit: Vec<usize>,
}

impl FenwickTree {
    fn new(n: usize) -> Self {
        FenwickTree { n: n, bit: vec![0; n] }
    }

    // [0, k)
    fn sum(&self, i: usize) -> usize {
        let mut s = 0;
        let mut i = i as isize;
        while i > 0 {
            i -= 1;
            s += self.bit[i as usize];
            i &= i + 1;
        }
        s
    }

    fn add(&mut self, i: usize, x: usize) {
        let mut i = i;
        while i < self.n {
            self.bit[i] += x;
            i |= i + 1;
        }
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const ll dx[] = {1,0,-1,0};
const ll dy[] = {0,1,0,-1};
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define m_p make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll l,r,ans=2019;
    cin >> l >> r;
    if(r-l>=2019){
        cout << 0 << endl;
        return 0;
    }
    REP(i,l,r){
        REP(j,i+1,r+1){
            ans = min(ans,((i%2019)*(j%2019))%2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
sp=[]

for _ in range(n):
    sp.append(input().split())

for i in sp:
    i[1]=-int(i[1])
    #文字列と合わせてsortしたら数値は低い順になるので符号逆にすることで実質高い順にできる
    i.append(sp.index(i))
    #今の位置(答える番号)がsp[i][2]に入っていく

sp.sort()

for i in sp:
    print(i[2]+1)
    #0始まりなので1足す


Measured memory_bytes: 3060
console.log(require('fs').readFileSync('/dev/stdin','utf8').trim().split(/[ |\n]/).slice(1).map((k,i,a)=>`node ${++i}: key = ${k}, `+((i-1)?`parent key = ${a[(i>>1)-1]}, `:'')+(2*i<=a.length?`left key = ${a[2*i-1]}, `:'')+(2*i<a.length?`right key = ${a[2*i]}, `:'')).join('\n'));


Measured memory_bytes: 16272
#include <iostream>

using namespace std;
int n;
int main(){
    cin >> n;
    int cnt = 1;
    if (n % 2 == 0) cout << -1;
    else{
        int sum = 7;
        while (cnt <= 1e7 && sum % n > 0){
            cnt++;
            sum = (sum * 10 + 7) % n;
        }
        if (cnt > 1e7) cout << -1; else cout << cnt;
    }
}


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

vector<int> arr[100010] = {};
int f[100010] = {};
int f2[100010] = {};

int n;

int dfs(int i,int j){
    
    if(i == n){
        f2[i] = 2;
        return f[i] = j;
    }
    
    if(f[i])
        return 0;
    
    //cout << i << " " << j << endl;
    
    f[i] = j;
    int res = 0;
    
    for( int next : arr[i] ){
        res = dfs(next,j+1);
        if(res){
            //cout << (res+1)/2 << " " << j << endl;
            if((res+1)/2 >= j){
                f2[i] = 1;
            }else{
                f2[i] = 2;
            }
        
            return res;
        }
    }
    
    return res;
}

int dfs2(int i,int j){
    
    if( f2[i] != 0 ){
        return 0;
    }
    
    f2[i] = j;
    
    for( int next : arr[i] ){
        dfs2(next,j);
    }
    return 0;
}

int main(void){
    
    cin >> n;
    
    for(int i = 0; i < n-1; i++){
        int a,b;
        cin >> a >> b;
        
        arr[a].push_back(b);
        arr[b].push_back(a);
        
    }
    
    int res = dfs(1,1);
    
    for(int i = 1; i <= n; i++){
        if(f2[i] != 0){
            for(int next : arr[i]){
                dfs2(next,f2[i]);
            }
        }
    }
    
    res = 0;
    
    for(int i = 1; i <= n; i++){
        //cout << f2[i] << " ";
        if( 1 == f2[i]){
            res++;
        }
    }
    //cout << endl;
    
    if(res > n-res){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    
}


Measured memory_bytes: 11136
import sys
sys.setrecursionlimit(100000)

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

R = {}
for a, b in AB:
  if a in R:
    R[a].append(b)
  else:
    R[a] = [b]

def nasu(x, e):
  D[x] = 1
  if x not in R:
    return []
  for i in R[x]:
    if i == e:
      return [i]
    if D[i] == 0:
      t = nasu(i, e)
      if t != []:
        return [i] + t
  return []

for i in range(1, N + 1):
  D = [0] * (N + 1)
  L = nasu(i, i)
  if L != []:
    break
else:
  print(-1)
  exit()

D = [0] * (N + 1)
for i in L:
  D[i] = 1

LEN = len(L)
L = L + L

i = 0
while i < LEN:
  for j in range(i + LEN - 1, i, -1):
    if D[L[j]] != 0 and L[j] in R[L[i]]:
      for k in range(j - 1, i, -1):
        D[L[k]] = 0
      i = j
      break

A = []
for i in range(LEN):
  if D[L[i]] == 1:
    A.append(L[i])

print(len(A))
for i in A:
  print(i)

Measured memory_bytes: 4212
def c(i, p, f, g, k, vis):
    if vis[i]:
        return
    vis[i] = True
    w = f[i] + p
    k[i] = w
    ch = g[i]
    for x in ch:
        c(x, w, f, g, k, vis)


def main():
    import sys
    sys.setrecursionlimit(300000)
    n, q, *abpx = map(int, sys.stdin.read().split())

    g = [[] for _ in range(n + 1)]
    for u, v in zip(*[iter(abpx[:2 * (n - 1)])] * 2):
        g[u].append(v)
        g[v].append(u)

    f = [0 for _ in range(n + 1)]

    for p, x in zip(*[iter(abpx[2 * (n - 1):])] * 2):
        f[p] += x

    k = [0 for _ in range(n + 1)]
    vis = [False for _ in range(n + 1)]

    c(1, 0, f, g, k, vis)
    ans = ' '.join(map(str, k[1:]))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 263616
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    string s, s2;
    ll k;
    cin >> s >> k;
    for(int i = 0; i < s.size(); i++) {
        s2 += s[i];
        if (s[i] != '1') {
            break;
        }
    }
    // cout << s2 << endl;
    if (k >= s2.size()) {
        cout << s2.back() << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}



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

        signed main() {
        int n;
        cin>>n;
       int a[n],b[n],x[n],y[n],ans=0,k;
       if(n%2){
       for(int i=0;i<n;i++){cin>>a[i];ans=ans^a[i];}
       for(int i=0;i<n;i++){cin>>b[i];ans=ans^b[i];}
       }
       else{
           for(int i=0;i<n;i++)cin>>a[i];
           for(int i=0;i<n;i++)cin>>b[i];
       }
         //cerr<<ans;
        for(int i=1;i<=28;i++){
            for(int j=0;j<n;j++)x[j]= a[j]-((a[j]>>(i))<<(i));
            for(int j=0;j<n;j++)y[j]= b[j]-((b[j]>>(i))<<(i));
            sort(x,x+n);sort(y,y+n);
            k=n-1;
            for(int j=0;j<n;j++){
                while(k>=0&&y[k]+x[j]>=(1ll<<(i)))k--;
                ans=ans^((1ll<<i)*((n-1-k)%2));
            }
           // cerr<<ans;

        }
        cout<<ans;


        }


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int i,j,k,T,A[3000],B[3000],N,memo1[3000][3001],memo2[3000][3001],ans;

int dp1(int n,int m)
{
  int s,t,u;
  
  if(memo1[n][m]!=-1)
  {
    return memo1[n][m];
  }
  
  if(n==0)
  {
    if(A[n]<=m)
    {
      memo1[n][m]=B[n];
      return B[n];
    }
    else
    {
      memo1[n][m]=0;
      return 0;
    }
  }
  
  t=dp1(n-1,m);
  if(A[n]<=m)
  {
    t=max(t,dp1(n-1,m-A[n])+B[n]);
  }
  
  memo1[n][m]=t;
  return t;
  
}

int dp2(int n,int m)
{
  int s,t,u;
  
  if(memo2[n][m]!=-1)
  {
    return memo2[n][m];
  }
  
  if(n==N-1)
  {
    if(A[n]<=m)
    {
      memo1[n][m]=B[n];
      return B[n];
    }
    else
    {
      memo1[n][m]=0;
      return 0;
    }
  }
  
  t=dp2(n+1,m);
  if(A[n]<=m)
  {
    t=max(t,dp2(n+1,m-A[n])+B[n]);
  }
  
  memo2[n][m]=t;
  return t;
  
}


int main()
{

  cin >> N >> T;
  for(i=0;i<N;i++)
  {
    cin >> A[i]>>B[i];
  }
  
  for(i=0;i<N;i++)
  {
    for(j=0;j<T+1;j++)
    {
      memo1[i][j]=-1;
      memo2[i][j]=-1;
    }
    memo1[i][0]=0;
    memo2[i][0]=0;
  }
  
  ans=0;
  ans=max(ans,dp2(1,T-1)+B[0]);
  ans=max(ans,dp1(N-2,T-1)+B[N-1]);
 
  for(i=1;i<N-1;i++)
  {
    for(j=0;j<=T-1;j++)
    {
      ans=max(ans,dp1(i-1,j)+dp2(i+1,T-j-1)+B[i]);
    }
  }
  
  cout<<ans;
  

  
 return 0; 
}

Measured memory_bytes: 70784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// ?¨??????\???????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];
		for (int i = 0; i < values.length; i++) {
			values[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int temp;
			temp = values[a];
			values[a] = values[b];
			values[b] = temp;
			// a??¨b????????£???values??????????????????
		}
		for (int i = 0; i < values.length; i++) {
			System.out.println(values[i]);
		}
		// values??????????????????
	}
}

Measured memory_bytes: 26068
#include <stdio.h>
int main(){
  int a ,b;
  scanf("%d %d",&a,&b);
  
  if(a < b){
    printf("a < b");
  }
  else if(a > b){ 
    printf("a > b");
  }
  else{ 
    printf("a == b");
  }
  printf("\n");
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	int t;
  	cin >> t;
  	if(t>=30)
      cout << "Yes";
    else
      cout << "No";
    return 0;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    map<string, int> counter;

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        counter[s]++;
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        string t;
        cin >> t;
        counter[t]--;
    }

    int ans = 0;
    for (auto &p : counter) {
        chmax(ans, p.second);
    }

    cout << ans << endl;

    return 0;
}


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


int main() {
	
	int N;
	cin >> N;
	
	set<int> s;
	
	for(int i=0; i<N; i++){
		int a;
		cin >> a;
		if (s.count(a)) s.erase(a);
		else (s.insert(a));
	}
	cout << s.size() << endl;
	
	
	return 0;
}

Measured memory_bytes: 4864
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int sum = 0;
            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();

                sum += r - l + 1;
            }

            out.println(sum);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> d(k);
	rep(i,k) cin >> d.at(i);
	for(int i=n;;++i){
		int j=i;
		bool flg=true;
		while(j>0){
			int a=j%10;
			rep(l,k) if(a==d.at(l)) flg=false;
			j/=10;
		}
		if(flg){
			cout << i << endl;
			return 0;
		}
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n,k;
string s;
ll ans;

int main(){
  cin >> n >> k;
  cin >> s;
  ll flag = 1;
  ll j = 0;
  ll i = 0;
  while(k > 0){
    while(j < n && s[j] == '1') j++;
    while(j < n && s[j] == '0') j++;
    while(j < n && s[j] == '1') j++;
    k--;
  }
  ans = j-i;
  for(ll i = 1;i < n;i++){
    if(s[i] == '0') continue;
    if(s[i-1] == '0'){
      while(j < n && s[j] == '1') j++;
      while(j < n && s[j] == '0') j++;
      while(j < n && s[j] == '1') j++;
      ans = max(ans,j-i);

      // cerr <<i << " " << j << endl;

    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
V, E = [int(_) for _ in input().split()]
G = {}

for i in range(V):
    G[i] = {}
for _ in range(E):
    s, t, c = [int(_) for _ in input().split()]
    s -= 1  # 0を始点とする場合
    t -= 1  # 0を始点とする場合
    G[s][t] = -c

INF = float('inf')

D = [INF] * V
D[0] = 0  # 0を始点とする場合
count = 0
while True:
    count += 1
    update = False
    update_n = False
    for s in G.keys():
        for t in G[s].keys():
            if D[s] != INF and D[t] > D[s] + G[s][t]:
                D[t] = D[s] + G[s][t]
                update = True
                if t == V - 1:
                    update_n = True
    if not update or count == V:
        break
if update_n:
    print('inf')
else:
    print(-D[-1])

Measured memory_bytes: 3444
from collections import deque

H,W = map(int,input().split())
A = [list(input()) for i in range(H)]

directions = [[-1,0],[1,0],[0,-1],[0,1]]

D = [[-1]*W for i in range(H)]

B = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            B.append([i,j])
            D[i][j] = 0

q = deque(B)

while q:
    nh,nw= q.pop()
    for dh,dw in directions:
        if not (0<= nh+dh < H and 0 <= nw+dw < W):
            continue
        elif D[nh+dh][nw+dw] != -1:
            continue
        elif A[nh+dh][nw+dw] == '#':
            D[nh+dh][nw+dw] = D[nh][nw]
            q.append([nh+dh,nw+dw])
        elif A[nh+dh][nw+dw] == '.':
            D[nh+dh][nw+dw] = D[nh][nw]+1
            q.appendleft([nh+dh,nw+dw])

print(max(max(D[i]) for i in range(H)))

Measured memory_bytes: 180908
import itertools

n, a, b, c = map(int, input().split())
ll = []
for _ in range(n):
  ll.append(int(input()))

cost = 10**10
for s in itertools.product(' ABC', repeat=n):
  al, bl, cl = [], [], []
  for i, _s in enumerate(s):
    if _s == 'A':
      al.append(ll[i])
    elif _s == 'B':
      bl.append(ll[i])
    elif _s == 'C':
      cl.append(ll[i])
  if not al or not bl or not cl:
    continue
  cost = min(cost, 
             10 * (len(al) - 1) + abs(a - sum(al)) + 
             10 * (len(bl) - 1) + abs(b - sum(bl)) + 
             10 * (len(cl) - 1) + abs(c - sum(cl)))
print(cost)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define PDD pair<LD,LD>
#define eps 1e-9
#define HH1 402653189
#define HH2 1610612741

int n, px[100055], py[100055], cur, ptrx, ptry;
bool vis[100055];
PII a[100055];
long long ans1, ans2;

int cx() {
	while (vis[px[ptrx]])
		ptrx++;
		
	int ind = px[ptrx];	
	
//	printf("[%d, %d]\n", a[ind].x, a[ind].y);
	
	vis[ind] = true;
	
	if (cur < a[ind].x) {
		int ret = a[ind].x - cur;
		cur = a[ind].x;
		return ret;
	} else 
	if (cur > a[ind].y) {
		int ret = cur - a[ind].y;
		cur = a[ind].y;
		return ret;
	} else {
		return 0;
	}
}

int cy() {
	while (vis[py[ptry]])
		ptry++;
		
	int ind = py[ptry];	
	
//	printf("[%d, %d]\n", a[ind].x, a[ind].y);
	
	vis[ind] = true;
	
	if (cur < a[ind].x) {
		int ret = a[ind].x - cur;
		cur = a[ind].x;
		return ret;
	} else 
	if (cur > a[ind].y) {
		int ret = cur - a[ind].y;
		cur = a[ind].y;
		return ret;
	} else {
		return 0;
	}
}


int main() {
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i].x, &a[i].y);
		px[i] = py[i] = i;
	}
	
	sort(px, px + n, [] (int u, int v) {
		return a[u].x > a[v].x;
	});
	
	sort(py, py + n, [] (int u, int v) {
		return a[u].y < a[v].y;
	});
	
	cur = ptrx = ptry = 0;
	
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0)
			ans1 += cx();
		else
			ans1 += cy();
	}
	
	ans1 += abs(cur);
	
	SET(vis, 0);
	
	cur = ptrx = ptry = 0;
	
	for (int i = 0; i < n; i++) {
		if (i % 2 == 1)
			ans2 += cx();
		else
			ans2 += cy();
	}
	
	ans2 += abs(cur);
	
	printf("%lld\n", max(ans1, ans2));
	
	return 0;
}

Measured memory_bytes: 1920
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)*}
    };
}

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)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        x:usize,
        a:usize,
    }
    let ans = if x >= a{
        10
    } else {
        0
    };
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
#define int long long
using namespace std;
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> P;
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
const ll MOD = 1e9+7;
const int MAX = 1001001;
ll 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;
    }
}
ll 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;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    COMinit();
    ll n,k; cin >> n >> k;
    ll ans=0;
    for(int i=0;i<=min(k,n-1);i++){
        if(i==0&&k%2==0) ans++;
        else{
            ans+=(COM(n,i)*COM(n-1,i))%MOD;
            ans%=MOD;
        }
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 23680
import java.io.*;
 
class Main {
    public static void main(String[] arg)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] div = str.split(" ");
        int s =  Integer.parseInt(div[0]);
        int l =  Integer.parseInt(div[1]);
        System.out.println(s*l + " "+ 2*(s+l));
    }   
}

Measured memory_bytes: 24200
while True:
    try:
        a=input().split()
        b=input().split()
        hit=0
        blow=0

        for i in range(4):
            for j in range(4):
                if(a[i]==b[i]):
                    hit+=1
                    break
                if(a[i]==b[j]):
                    blow+=1
                    break

        print(hit, blow)
        
    except EOFError:
        break


Measured memory_bytes: 5560
#include<stdio.h>
int n,a,b[200000]={},i,r=0;
int main(){
    scanf("%d",&n);
    for(i=0;i<n-1;i++){
        scanf("%d",&a);
        b[a-1]++;
    }
    for(i=0;i<n;i++)printf("%d\n",b[i]);
    return 0;
}

Measured memory_bytes: 2460
S = list(input())

S0 = []
S1 = []

for i in range(len(S)):
    S0.append(str(i%2))
    S1.append(str(int(not i%2)))

#  print(S)
#  print(S0)
#  print(S1)

S0_count = 0
S1_count = 0


for i in range(len(S)):
    if S[i] != S0[i]:
        S0_count += 1
    if S[i] != S1[i]:
        S1_count += 1

print(min(S0_count, S1_count))











Measured memory_bytes: 16596
#include <iostream>
#include <map>
#include <algorithm>    
#include <vector>       
#include <set>
#include <utility>  
#include <cstring>
#include <stdio.h>
#include <limits.h>
#include <queue>
#include <algorithm> 
#define MAX_DOUBLE  40000000000.0 
#include <math.h> 
#include <unistd.h>

using namespace std;

long long mod = 1e9 + 7; 

long long res[10010][100];

int main(){
	string s;
	cin>>s;
	int d;
	cin>>d;
	
	int len = s.size();
	
	for(int i = 0; i < 10; i++){
		res[0][i%d] ++;
	}
	
	for(int i = 1; i <= len; i++ ){
		for(int j = 0; j < d; j++){
			for(int z = 0; z < 10; z++){
				res[i][(j+z)%d] += res[i-1][j];
				res[i][(j+z)%d] %= mod;
			}
		}
	}
	
	long long ans = 0;
	
	int bla = 0;
	
	for(int i = 0; i<len; i++){
		if(i == len-1){
			int s_num = s[i] - '0';
			for(int q = 0; q<=s_num; q++){
				if((bla + q)%d == 0){
					ans +=1;
					ans %= mod; 
				}
			}
			
			break;
		}
		
		int s_num = s[i] - '0';
		for(int j = 0; j < s_num; j++){
			for(int cif = 0; cif < d; cif++){
				int tmp = j + bla + cif;				
				if(tmp % d == 0){
					ans += res[len-2-i][cif];
					ans %= mod; 
				}
				
			}
		}
		bla += s_num;
	}	

	cout<<(ans-1 + mod) % mod<<endl;	
	
		
}

Measured memory_bytes: 8064
a, b = map(int, input().split())
s = [['#'] * 100 for i in range(50)] + [['.'] * 100 for i in range(50)]
for i in range(a - 1):
    s[i * 2 // 100 * 2][i * 2 % 100] = '.'
for i in range(b - 1):
    s[51 + i * 2 // 100 * 2][i * 2 % 100] = '#'
print(100, 100)
for row in s:
    print(''.join(row))


Measured memory_bytes: 3060
n = int(input())
s = input()

unpair = 0
left = 0
right = 0
for c in s:
    if(c == "("):
        unpair += 1
    else:
        if(unpair):
            unpair -= 1
        else:
            left += 1
right = unpair

print("(" * left + s + ")" * right)


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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (x <= 0) {
      break;
    }
    x -= a.at(i);
    ans++;
  }
  if (x) {
    ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3584
N = int(input())
A = list(map(int, input().split()))

B = [i-A[i] for i in range(N)]
C = [i+A[i] for i in range(N)]

B.sort()
C.sort()

j = 0
ct = 0
cashe = 0
for i in range(N):
  if i >= 1 and B[i-1] == B[i]:
    ct += cashe
  else:
    cashe = 0
    while C[j] <= B[i]:
      if C[j] == B[i]:
        ct += 1
        cashe += 1
      j += 1
      
print(ct)
      
  

Measured memory_bytes: 117748
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = []
for i in range(n):
  ans.append(1)
for i in range(m):
  a,b = map(int,input().split())
  if(h[a-1]>h[b-1]):
    if(ans[b-1]==1):
      ans[b-1]-=1
  elif(h[b-1]>h[a-1]):
    if(ans[a-1]==1):
      ans[a-1]-=1
  else:
    ans[a-1]-=1
    ans[b-1]-=1
anss = 0
for i in range(n):
  if(ans[i]==1):
    anss+=ans[i]
print(anss)

  

Measured memory_bytes: 20144
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <time.h>
#include <functional>

//#include "All.h"

using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    REP(i, b) tmp *= a;
    return tmp;
}

ll A;
float B;

int main() {
    ll a;
    float b;
    cin >> a >> b;
    ll tb = b * 100 + 0.01;

    ll ans = a * tb;

    ans /= 100;

    cout << ans << endl;

    return 0;
}


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

using namespace std;

string S, p;

int main () {

    cin >> S;

    if (S == "Sunny"){
        p = "Cloudy";
    }
    else if (S == "Cloudy") {
        p = "Rainy";
    }
    else if (S == "Rainy") {
        p = "Sunny";
    }

    cout << p << "\n";

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
signed main () {
	int n, k;
  	cin >> n >> k;
  	for (int i = 1; i <= n; ++i) {
    	char c;
      	cin >> c;
      	if (i != k)
          	cout << c;
      	else if (c == 'A')
          	cout << 'a';
      	else if (c == 'B')
          	cout << 'b';
      	else
          	cout << 'c';
    }
  	cout << '\n';
}

Measured memory_bytes: 256
N, P = map(int, input().split())
S = input()
from collections import Counter
ans = 0
if P == 2 or P == 5:
    for i in range(N-1, -1, -1):
        t = S[i]
        if not int(t) % P:
            ans += i + 1
else:
    c = Counter()
    c[0] += 1
    p = 1
    t = int(S[N-1])
    c[t%P] += 1
    for i in range(N-2, -1, -1):
        p *= 10
        t = int(S[i]) * p + t
        c[t % P] += 1
        p %= P
    for a in c.values():
        ans += (a * (a-1)) // 2
print(ans)


Measured memory_bytes: 4456
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int l; cin >> l;
	double a = l/3.;
	double ans = a*a*a;	
	cout16 << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

ll gcd(ll a,ll b){
    if (b==0)return a;
    return gcd(b,a%b);
}

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  
  return i;
}
bool judge(string s){
  bool ret = false;
  string t = s;
  reverse(t.begin(), t.end());
  if(s == t){
    ret = true;
  }
  return ret;
}

//map<ll,ll> m;
void solve(){
  ll a;
  cin >> a;
  ll k;cin >> k;
  cout << min(a%k,k-a%k) << endl;

}


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


Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,x;
    scanf("%d",&n);
 
    for(int i = 1; i<= n; i++)
    {
        if(i%3 == 0){
            printf(" %d",i);
        }else{
            x = i;
            do{
                if(x%10 == 3){
                    printf(" %d",i);
                    break;
                }
                x /=10;
            }while(x);
        }
    }
    printf("\n");
}


Measured memory_bytes: 2756
#include <bits/stdc++.h>
#include <vector>
#include <math.h>

using namespace std;



int main(){

  string a,b; cin>>a>>b;

  int x = stoi(a+b);
  int r = (int)sqrt(x);

  if(r*r == x) cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;


return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) {
    cin >> h.at(i);
  }
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g.at(a).push_back(b);
    g.at(b).push_back(a);
  }

  int ans = 0; 
  for (int i = 0; i < n; ++i) {
    bool f = true;
    for (int x : g.at(i)) {
      if (h.at(x) >= h.at(i)) {
        f = false;
      }
    }
    if (f) ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8800
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    string S, T;
    cin >> S >> T;
    for (int i = 0; i < (int)S.size(); i++) {
        if (S == T) {
            cout << "Yes" << endl;
            return 0;
        }
        S.insert(S.begin(), S[(int)S.size() - 1]);
        S.pop_back();
    }
    cout << "No" << endl;
}


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

int main()
{
	while (true){
		int n, dist = 0, who = 0;
		cin >> n;
		if (!n) break;
		for (int i = 0; i < n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if (dist < d1 + d2) dist = d1 + d2, who = p;
		}
		cout << who << " " << dist << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  char A, B, C;
  A = a.at(0) - 32;
  B = b.at(0) - 32;
  C = c.at(0) - 32;
  cout << A << B << C;
}


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

map<int, int> primeFactor(long long in) {
	map<int, int> ans;
	
	if (in < 2) return ans;

	long long a = 1;
	while (a*a <= in) {
		a *= 2;
	}

	for (int b = 2; b <= a; b++) {
		while (in % b == 0) {
			in /= b;
			ans[b]++;
		}
	}

	return ans;
}

int main(){
	long long N;
	scanf("%lld", &N)+1;

	double sq = sqrt((double)N);
	int isq = floor(sq);

	for (int i = isq; i > 0; i--) {
		if (N % i == 0) {
			printf("%lld", i + N/i - 2);
			return 0;
		}
	}
}


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

int main(){

	while(1){
		int l, num;
		vector<int> a;

		cin>>l;
		if(l == 0)
			break;

		for(int i=0;i<l;i++){
			cin>>num;
			a.push_back(num);
		}

		bool turn = true;
		int ohajiki = 32, j = 0;

		while(ohajiki != 0){
			if(turn){
				ohajiki -= (ohajiki-1)%5;
			}else{
				ohajiki -= a[j];
				j++;
				if(j == l)
					j = 0;
			}

			if(ohajiki < 0)
				ohajiki = 0;

			cout<<ohajiki<<endl;
			turn = !(turn);
		}
	}

	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    string s;
    cin>>s;
    cout<<s.substr(0,s.size()-8)<<"\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    string s,t;cin>>s>>t;
    rep(i,n)cout<<s[i]<<t[i];
    cout<<endl;
}

Measured memory_bytes: 3588
inl = input().split(' ')
num = int(inl[0])
k = int(inl[1])
q = int(inl[2])

a = [0]*q
for i in range(q):
	a[i] = int(input())-1

s = [0]*num

for ans in a:
	s[ans] += 1

for score in s:
	result = k-(q-score)
	if result < 1:
		print('No')
	else:
		print('Yes')




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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (((100*a) + (10*b) + c)%4 == 0)
    cout <<  "YES" << endl;
  else 
    cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A = rl()

A.sort()
m = A[-1]

import collections
h = collections.Counter(A)

ans = 0
for a in A:
	if h[a] == 0:
		continue
	if h[a] == 1:
		ans += 1
	for j in range(a, m+1, a):
		h[j] = 0
print(ans)


Measured memory_bytes: 175468
class Array
  def rank
    tmp = self.sort
    self.map { |v| tmp.index(v) + 1 } 
  end
end

while true
  w, h = gets.split.map(&:to_i)
  break if w == 0
  xa = {}; ya = {}
  xa[0] = 0; xa[w] = 0
  ya[0] = 0; ya[h] = 0
  points = []
  gets.to_i.times do
    p = gets.split.map(&:to_i)
    points << p
    xa[p[0]] ||= 0; xa[p[2]] ||= 0
    ya[p[1]] ||= 0; ya[p[3]] ||= 0
  end
  xa.keys.rank.zip(xa.keys).each{ |r, x| xa[x] = r }
  ya.keys.rank.zip(ya.keys).each{ |r, y| ya[y] = r }
  xs = xa.size; ys = ya.size
  fld = Array.new(ys+1){ Array.new(xs+1, true) }
  fld[0].fill(false); fld[ys].fill(false)
  fld.map{ |arr| arr[0] = arr[xs] = false }
  for p in points
    x1, y1, x2, y2 = p
    for y in (ya[y1]...ya[y2])
      for x in (xa[x1]...xa[x2])
        fld[y][x] = false
      end
    end
  end
  ret = 0
  for y in (1...ys)
    for x in (1...xs)
      next unless fld[y][x]
      arr = []
      arr << [y, x]
      until arr.empty?
        ny, nx = arr.shift
        [[-1,0],[0,-1],[1,0],[0,1]].each do |dy, dx|
          px = nx+dx; py = ny+dy
          if fld[py][px]
            arr << [py, px] 
            fld[py][px] = false
          end
        end
      end
      ret += 1
    end
  end
  p ret
end

Measured memory_bytes: 14300