akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCoder
{
 
    class Program
    {
        static void Main()
        {
            Solve();
 
            Console.ReadKey();
        }
 
        static void Solve()
        {
            var cin = GetIntArray();
            var left = cin[0] + cin[1];
            var right = cin[2] + cin[3];
            var ans = left > right ? "Left" : left == right ? "Balanced" : "Right";
 
            Console.Write(ans);
        }
 
 
 
        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
 
        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

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

int N,M;

int R,Q;
int t[1001],n[1001],m[1001],s[1001];
int st[51],ed[51],tar[51];

void solve(){
  cin>>R;
  for(int i=0;i<R;i++) cin>>t[i]>>n[i]>>m[i]>>s[i];
  cin>>Q;
  for(int i=0;i<Q;i++) cin>>st[i]>>ed[i]>>tar[i];

  vector<int> ans;
  for(int i=0;i<Q;i++){
    int res=0;
    int dep=0;
    int start=0;
    for(int j=0;j<R;j++){
      if(tar[i]!=m[j]) continue;
      if(s[j]==1){
        if(dep==0) start=t[j];
        dep++;
      }else{
        dep--;
        if(dep==0){
          int ma=max(st[i],start);
          int mi=min(ed[i],t[j]);
          if(mi-ma>0) res+=(mi-ma);
          start=0;
        }
      }
    }
    ans.push_back(res);
  }

  for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
}

int main(){
  while(1){
    cin>>N>>M;
    if(N==0&&M==0) break;
    solve();
  }

  return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;

#ifdef WIN32
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 200005;

vector<int> gr[maxn];
bool was[maxn];
int n, m;

void go(int cur)
{
    if (was[cur]) return;
    was[cur] = true;
    for (auto t : gr[cur]) go(t);
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i =0 ; i < n; i++)
    {
        int k;
        scanf("%d", &k);
        for (int j = 0; j < k; j++)
        {
            int x;
            scanf("%d", &x);
            x--;
            gr[i].pb(n + x);
            gr[n + x].pb(i);
        }
    }
    go(0);
    for (int i = 0; i < n; i++) if (!was[i])
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> key(m);
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        int s = 0;
        rep(j, 0, b) {
            int c;
            cin >> c;
            c--;
            s |= 1 << c;
        }
        key[i] = make_pair(s, a);
    }

    vector<int> dp(1 << n, INF);
    dp[0] = 0;
    rep(s, 0, (1 << n)) {
        rep(i, 0, m) {
            int t = s | key[i].first;
            int cost = dp[s] + key[i].second;
            dp[t] = min(dp[t], cost);
        }
    }

    int ans = dp[(1 << n) - 1];
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};
int t[7]={},y[7]={};

int main() {

	int h,w,k;
	char c[7][7];

	cin>>h>>w>>k;

	int total=0;
	rep(i,h){
		rep(j,w){
			cin>>c[j][i];
			if(c[j][i]=='#'){
				t[j]++;
				y[i]++;
				total++;
			}
		}
	}
	int ans=0;
	rep(i,1<<(h+w)){
		int x=0;
		rep(j,h){
			if(i&(1<<j))x+=y[j];
		}
		rep(l,w){
			if(i&(1<<(l+h))){
				x+=t[l];
				rep(m,h){
					if(i&(1<<m)){
						if(c[l][m]=='#')x--;
					}
				}
			}
		}
		if(x==total-k){
			ans++;
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3624
from itertools import permutations

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

g = [[0] * n for _ in range(n)]
for a, b in ab:
    a -= 1
    b -= 1
    g[a][b] = 1
    g[b][a] = 1

ans = 0
for pat in permutations(range(1, n), n - 1):
    is_path = True
    u = 0
    for v in pat:
        if g[u][v] == 0:
            is_path = False
        u = v

    if is_path:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

int main()
{
    vector<int> tri(3);
    cin >> tri[0] >> tri[1] >> tri[2];

    sort(tri.begin(),tri.end(),greater<int>());

    int count = 0;
    while (tri[1] < tri[0]) {
        tri[1]++; tri[2]++;
        count++;
    }
    if (tri[0]%2 != tri[2]%2) {
        tri[0]++; tri[1]++;
        count++;
    }
    while (tri[2] < tri[0]) {
        tri[2] += 2;
        count++;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
class unionfind():

    def __init__(self,n):
        #親番号<0なら根
        #根の場合、数値の絶対値が要素数
        self.par=[-1 for i in range(n)]
        
    def root(self,x):
        
        par=self.par
        if par[x]<0:
            return x
        else:
            self.x = self.root(par[x])
            return self.x
        
    def unite(self,x,y):
        #高いほうに低いほうをくっつける
        rx=self.root(x)
        ry=self.root(y)
        
        if rx==ry:
            return
        else:
            if self.par[rx]>self.par[ry]:
                rx,ry = ry,rx
                
            self.par[rx]+=self.par[ry]
            self.par[ry] = rx

            
    def same(self, x,y):
        return self.root(x) == self.root(y)
    
    def par_print(self):
        print(self.par)
        
    def count(self, x):
        return -self.root(x)
    
n,m = map(int,input().split())

friend = unionfind(n)

for i in range(m):
    a,b = map(int,input().split())
    friend.unite(a-1,b-1)
    # print(friend.par_print())
    
# print(friend.par_print())

ans = -min(friend.par)

print(ans)

Measured memory_bytes: 86992
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String t = in.next();
		int ans = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) != t.charAt(i)) ans += 1;
		}
		System.out.println(ans);
	}
}

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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    int n,d; cin >> n >> d;
    int count = 0;
    rep(i,n)
    {
        int a, b;
        cin >> a >> b;
        double dist = sqrt(pow(a, 2) + pow(b, 2));
        if( dist <= d)
            ++count;
    }
    pri(count);  
   
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main(void){
    // Your code here!
    int N,D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    
    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++){
            cin >> X.at(i).at(j);
        }
    }
    int count=0;
    for(int i=0;i<N-1;i++){
        for(int j=i;j<N;j++){
            int sum = 0;
            for(int k=0;k<D;k++){
                sum += (X.at(i).at(k) - X.at(j).at(k)) * (X.at(i).at(k) - X.at(j).at(k));
            }
            float s = sqrt(sum);
            if((s-floor(s)) == 0 && s!=0){
                count += 1;
            }
        }
    }
    
    cout << count << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author iavanish
 */
public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BHomework solver = new BHomework();
        solver.solve(1, in, out);
        out.close();
    }

    static class BHomework {

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            for (int i = 0; i < m; i++) {
                n -= in.nextInt();
            }

            out.println(0 <= n ? n : -1);
        }

    }

    static class FastReader {

        private final int BUFFER_SIZE = 1 << 16;
        private final InputStream inputStream;
        private final byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public FastReader() {
            this.inputStream = new DataInputStream(System.in);
            this.buffer = new byte[BUFFER_SIZE];
            this.bufferPointer = bytesRead = 0;
        }

        public FastReader(InputStream inputStream) {
            this.inputStream = inputStream;
            this.buffer = new byte[BUFFER_SIZE];
            this.bufferPointer = bytesRead = 0;
        }

        public FastReader(String fileName) {
            try {
                this.inputStream = new DataInputStream(new FileInputStream(fileName));
                this.buffer = new byte[BUFFER_SIZE];
                this.bufferPointer = bytesRead = 0;
            } catch (FileNotFoundException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            int nextInt = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean negative = (c == '-');
            if (negative) {
                c = read();
            }
            do {
                nextInt = nextInt * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (negative) {
                return -nextInt;
            }
            return nextInt;
        }

        private void fillBuffer() {
            try {
                bytesRead = inputStream.read(buffer, bufferPointer = 0, BUFFER_SIZE);
                if (bytesRead == -1) {
                    buffer[0] = -1;
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        private byte read() {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

    }

}



Measured memory_bytes: 25708
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<17;
	vector<int> vec[1<<18];
	segtree(){
	}

	void update(int k,int v){
		k+=N-1;
		vec[k].push_back(v);
		while(k>0){
			k=(k-1)/2;
			vec[k].push_back(v);
		}
	}
	void init(){
		for(int i=0;i<N*2-1;i++){
			sort(vec[i].begin(),vec[i].end());
			vec[i].erase(unique(vec[i].begin(),vec[i].end()),vec[i].end());
		}
	}

	int query(int a,int b,int v,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return INF;
		if(a<=l && r<=b){
			if(vec[k].size()==0)return INF;
			int v1=lower_bound(vec[k].begin(),vec[k].end(),v)-vec[k].begin();
			if(v1==vec[k].size())return abs(vec[k][v1-1]-v);
			if(v1==0)return abs(vec[k][v1]-v);
			return min(abs(vec[k][v1-1]-v),abs(vec[k][v1]-v));
		}
		int mid=(l+r)/2;
		int vl=query(a,b,v,k*2+1,l,mid);
		int vr=query(a,b,v,k*2+2,mid,r);
		return min(vl,vr);
	}
};



struct query{
	static const int B=330;
	int l,r,d,id;
	query(){}
	query(int l1,int r1,int d1,int ii){
		l=l1;
		r=r1;
		d=d1;
		id=ii;
	}
	bool operator<(const query& qu)const{
		if((l/B)==(qu.l/B)){
			return r<qu.r;
		}
		return l<qu.l;
	}
};

segtree seg;
int n,Q;
int a[100005];
query q[100005];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		seg.update(i,a[i]);
	}
	seg.init();
	scanf("%d",&Q);
	for(int i=0;i<Q;i++){
		scanf("%d%d%d",&q[i].l,&q[i].r,&q[i].d);
		q[i].r++;
		printf("%d\n",seg.query(q[i].l,q[i].r,q[i].d));
	}
	return 0;
}



Measured memory_bytes: 22860
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
int main()
{
    int A,B;
    cin >> A >> B;
    cout << (6-A-B) << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
string a,b;
int cmp_down(char a,char b)
{
	return a>b;
}
int main()
{
	cin>>a>>b;
	sort(a.begin(),a.end());
	sort(b.begin(),b.end(),cmp_down);
	if(a<b)
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var n = cin.ReadInt();
            var a = cin.ReadInt();
            var b = cin.ReadInt();
            WriteLine(Min(a * n, b));
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int cnt = 0;
	for( char c : s ){
		if( c == '2' ) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
 
int n,k;
int dp[100005][102];
const int MOD = 1e9+7;

 
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin>>n>>k;
	dp[0][0] = 1;
	for(int i=1;i<=n;i++){
		int v;
		cin>>v;
		int cm = 0;
		for(int j=0;j<=v;j++){
			cm += dp[j][i-1];
			if(cm >= MOD) cm-=MOD;
			dp[j][i] = cm;
		}
		for(int j=v+1;j<=k;j++){
			cm -= dp[j-v-1][i-1];
			cm += dp[j][i-1];
			if(cm >= MOD) cm-= MOD;
			if(cm < 0) cm += MOD;
			dp[j][i] = cm;
		}
	}
	
	//for(int i=0;i<=n;i++){
	//	for(int j=0;j<=k;j++){
	//		cout<<dp[j][i]<<" ";
	//	}cout<<endl;
	//}
	
	cout<<dp[k][n];
	
	return 0;
}


Measured memory_bytes: 40064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class AIrreversibleOperation {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        int b = 0;
        ll res = 0;
        trav(c, str) {
            if (c == 'B') {
                b++;
            } else {
                res += b;
            }
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    AIrreversibleOperation solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
 using namespace std;
#include <math.h>

int main() {
	int W,H,x,y,r=0;

	cin >> W >> H >> x >> y >> r;

	if((r<=x && x<=W-r) && (r<=y && y<=H-r)){
		cout << "Yes" <<endl;
	}else{
		cout << "No" <<endl;
	}
  return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;string S;cin>>N>>S;int R=0;
  vector<int>V(N+1),A(N);
  for(int X=0;X<N;X++){
    if(S[X]=='W')
      V[X+1]++;
    else{
      V[0]++;V[X]--;
    }
  }
  for(int X=0;X<N;X++){
    R+=V[X];
    A[X]=R;
  }
  sort(A.begin(),A.end());
  cout<<A[0]<<endl;
}


Measured memory_bytes: 6164
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    int a[M], b[M];
    int count;
    bool flag;

    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i];
    }

    vector<int> path(N);
    iota(path.begin(), path.end(), 1);

    count=0;
    do{

        for(int i=0; i<N-1; i++){
            flag=false;
            for(int j=0; j<M; j++){
                if( path.at(i)==a[j] && path.at(i+1)==b[j]  ){
                    flag=true;
                }else if( path.at(i)==b[j] && path.at(i+1)==a[j]  ){
                    flag=true;
                }
            }
            if(!flag){
                break;
            }
        }
        if(flag){
            //for(auto x : path) cout << x << " "; cout << endl;
            count++;
        }
    }while( next_permutation( next(path.begin()), path.end() ) );

    cout << count << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

const int MOD = 1e9+7;


int main()
{
    int n, k;
    cin >> n >> k;
    vector <vector <ll>> dp(n+1, vector <ll> (k+1, 0));
    vector <ll> a(n+1);
    for (int i=1; i<=n; ++i)
        cin >> a[i];

    for (int j=0; j<=k; ++j)
        dp[0][j] = 1;

    for (int i=1; i<=n; ++i)
    {
        for (int j=0; j<=k; ++j)
        {
            if (j)
                dp[i][j] = dp[i][j-1];
            dp[i][j] += dp[i-1][j];
            if (j - a[i] - 1 >=0)
                dp[i][j] += MOD - dp[i-1][j-a[i]-1];
            dp[i][j]%=MOD;
        }
    }

    cout << (MOD + dp[n][k] - (k!=0)*dp[n][k-1])%MOD;
    return 0;
}

Measured memory_bytes: 81012
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =  new Scanner(System.in);
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    if (a <= b){
      for(int i = 0; i < b; i++){
        System.out.print(a);
      }
    }
    else {
      for (int j = 0; j < a; j++){
        System.out.print(b);
      }
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int INF = INT_MAX;
int CNT = 0;
void merge(vector<int> &S, int left, int mid, int right) {
  int nl = mid - left, nr = right - mid;
  vector<int> L(nl + 1), R(nr + 1);
  for (size_t i = 0; i < nl; i++) {
    L.at(i) = S.at(left + i);
  }
  L.at(nl) = INF;

  for (size_t i = 0; i < nr; i++) {
    R.at(i) = S.at(mid + i);
  }
  R.at(nr) = INF;

  int i = 0, j = 0;
  for (int k = left; k < right; k++) {
    CNT++;
    if (L[i] <= R[j]) {
      S[k] = L[i++];
    } else {
      S[k] = R[j++];
    }
  }
}
void mergeSort(vector<int> &S, int left, int right) {
  if ((right - left) == 1) return;
  int mid = (left + right) / 2;
  mergeSort(S, left, mid);
  mergeSort(S, mid, right);
  merge(S, left, mid, right);
}
int main() {
  int n;
  cin >> n;
  vector<int> S(n);
  for (size_t i = 0; i < n; i++) {
    cin >> S.at(i);
  }

  mergeSort(S, 0, n);

  int i = 0;
  while (i != n - 1) {
    cout << S.at(i) << ' ';
    i++;
  }
  cout << S.at(i) << endl;
  cout << CNT << endl;
}


Measured memory_bytes: 6804
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// ll abs(ll n){
//     return n>0? n : n*(-1);
// }
int main() {
    int n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i]; 
    }
    ll dp[n];
    dp[0]=0;
    dp[1]=abs((arr[1]-arr[0]));
    for(int i=2; i<n ; i++){

        dp[i]= min(dp[i-1] + abs((arr[i]- arr[i-1])) , dp[i-2] + abs((arr[i]- arr[i-2])));
        
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#define PI 3.14159265
using namespace std;

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

    int n, arr[1002] = {0};
    double sum = 0, avg = 0, result;
    while (1) {
        cin >> n;
        if (n == 0) {return 0;}

        sum = 0;
        for (int i = 0; i < n; ++i) {
            cin >> arr[i];
            sum += arr[i];
        }
        avg = sum / n;

        sum = 0;
        for (int i = 0; i < n; ++i) {
            sum += pow(arr[i] - avg, 2);
        }
        result = sqrt(sum / n);

        printf("%.4lf\n", result);
    }
}

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

int dp[1010][1010];

int main()
{
  int q;
  string x,y;

  cin >> q;

  for(int t = 0;t < q;t++){
    cin >> x;
    cin >> y;

    memset(dp, 0, sizeof(dp));
    
    for(int i = 1;i <= x.size();i++){
      for(int j = 1;j <= y.size();j++){

	if(x[i-1] == y[j-1]){
	  dp[i][j] = dp[i-1][j-1]+1;
	}
	else if(dp[i-1][j] <= dp[i][j-1]){
	  dp[i][j] = dp[i][j-1];
	}
	else{
	  dp[i][j] = dp[i-1][j];
	}
      }
    }
    cout << dp[x.size()][y.size()] << endl;
  }
  return 0;
}



Measured memory_bytes: 7140
/**
*	  Name: Ajay Subhash Jadhav
*	  Institute: International Institute of Technology Hyderabad 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
using namespace std;

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

string s;
int n;

int f(int i,char prev)
{
	if(i==n)
		return 0;
	int ans;
	if(prev=='.')
		return f(i+1,s[i]);
	else if(prev==s[i])
	{
		if(prev=='0')
		{
			s[i]='1';
			return 1+f(i+1,s[i]);
		}
		else
		{
			s[i]='0';
			return 1+f(i+1,s[i]);
		}
	}
	return f(i+1,s[i]);
}

int main()
{      
  fastio();
  cin>>s;
  n=s.size();
  cout<<f(0,'.');
  
  return 0;
}

Measured memory_bytes: 2000
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
#include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)   (x).begin(),(x).end()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define mp       make_pair
#define eb       emplace_back
typedef pair<LL, LL> P;
typedef pair<LL, P> PP;

int n, a[202020], b[202020], maxl = -INF, minl = INF, omaxl, ominl, c[202020];
int comp(int x, int y) {
	return a[x]<a[y];
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i] >> b[i];
		 c[i] = i;
		if (a[i]>b[i])swap(a[i], b[i]);
		if (maxl<b[i])maxl = b[i], omaxl = a[i];
		if (minl>a[i])minl = a[i], ominl = b[i];
	}
	int _mx = omaxl, _mn = ominl;
	for (int i = 1; i <= n; ++i)
		_mx = max(_mx, a[i]), _mn = min(_mn, b[i]);
	long long ans = 1ll * (maxl - _mn)*(_mx - minl);
	sort(c + 1, c + n + 1, comp);
	int x = INF;
	for (int i = 1; i <= n; ++i)
		ans = min(ans, 1ll * (maxl - minl)*(_mx - min(a[c[i]], x))), x = min(b[c[i]], x), _mx = max(_mx, b[c[i]]);
	cout << ans << endl;
}

Measured memory_bytes: 2560
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        h: u32,
        w: u32,
        k: u32,
        c: [Chars; h],
    }

    let mut total_black: u32 = 0;
    for i in &c {
        total_black += i.into_iter().filter(|&a| a == &'#').count() as u32;
    }
    // println!("{}", total_black);

    let mut ans = 0;
    for bit_row in 0..2u32.pow(h) {
        // println!("bit_row: {}", bit_row);
        let mut red_rows = vec!();
        for i in 0..h {
            if bit_row & (1 << i) > 0 {
                red_rows.push(i);
            }
        }
        // println!("red_rows: {:?}", red_rows);
        for bit_col in 0..2u32.pow(w) {
            // println!("bit_col: {}", bit_col);
            let mut red_cols = vec!();
            for i in 0..w {
                if bit_col & (1 << i) > 0 {
                    red_cols.push(i);
                }
            }
            // println!("red_cols: {:?}", red_cols);

            let mut current_black = total_black;
            'i_loop:
            for i in 0..h {
                for j in 0..w {
                    if red_rows.contains(&i) || red_cols.contains(&j) {
                        if c[i as usize][j as usize] == '#' {
                            current_black -= 1;
                            if current_black < k {
                                break 'i_loop;
                            }
                        }
                    }
                }
            }
            if current_black == k {
                // println!("{}", current_black);
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int N,K;
    cin >> N >> K;

    vector<int> x(N),y(N);
    vector<char> c(N);
    vector<vector<int>> sum(2*K+1,vector<int>(2*K+1));
    rep(i,0,N){
        cin >> x[i] >> y[i] >> c[i];
        x[i]%=2*K;
        y[i]%=2*K;
        if(c[i]=='W') ++sum[0][0];
    }

    function<void(int,int,int,int,int)> add=[&](int x1,int y1,int x2,int y2,int v){
        if(2*K<x1){
            add(x1%(2*K),y1,x2%(2*K),y2,v);
            return;
        }
        if(2*K<y1){
            add(x1,y1%(2*K),x2,y2%(2*K),v);
            return;
        }
        if(2*K<x2){
            add(x1,y1,2*K,y2,v);
            add(0,y1,x2%(2*K),y2,v);
            return;
        }
        if(2*K<y2){
            add(x1,y1,x2,2*K,v);
            add(x1,0,x2,y2%(2*K),v);
            return;
        }
        sum[x1][y1]+=v;
        sum[x2][y1]-=v;
        sum[x1][y2]-=v;
        sum[x2][y2]+=v;
    };
    rep(i,0,N){
        if(c[i]=='B'){
            add(x[i],y[i],x[i]+K,y[i]+K,1);
            add(x[i]+K,y[i]+K,x[i]+2*K,y[i]+2*K,1);
        }else{
            add(x[i],y[i],x[i]+K,y[i]+K,-1);
            add(x[i]+K,y[i]+K,x[i]+2*K,y[i]+2*K,-1);
        }
    }

    int ans=0;
    rep(j,0,2*K) rep(i,1,2*K) sum[i][j]+=sum[i-1][j];
    rep(i,0,2*K) rep(j,1,2*K){
        sum[i][j]+=sum[i][j-1];
        ans=max(ans,sum[i][j]);
    }

    cout << ans << endl;

}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 16896
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    ll X;
    cin >> X;
    for (int i = 0;; i++) {
        X -= i;
        if (X <= 0) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use feature qw/say/;

my $line = <STDIN>;
my @ns = split(/\s+/, $line);
@ns = sort { $a <=> $b } @ns;
if ($ns[0] == 5 && $ns[1] == 5 && $ns[2] == 7) {
    say 'YES';
} else {
    say 'NO';
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;

template <class T>
class SegTree {
    int n;
    vector<T> data;
    T def;
    function<T(T,T)> operation;
    function<T(T,T)> update;

    T _query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return def;
        if(a <= l && r <= b) return data[k];
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }
  public:
    SegTree(size_t _n, T _def, function<T(T,T)> _operation, function<T(T,T)> _update)
    : def(_def), operation(_operation), update(_update) {
            n = 1;
            while(n < _n) {
                n *= 2;
            }
            data = vector<T>(2*n-1, def);
    }

    void set(int i, T x) {
        data[i+n-1] = x;
    }
 
    void build() {
        for(int k = n-2; k >= 0; --k) {
            data[k] = operation(data[2*k+1], data[2*k+2]);
        }
    }

    void change(int i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while(i > 0) {
            i = (i-1)/2;
            data[i] = operation(data[2*i+1], data[2*i+2]);
        }
    }

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

    T operator[](int i) {
        return data[i+n-1];
    }
};


int main()
{
    int n,Q;
    string s;
    cin >> n >> s >> Q;
    SegTree<int> st(n,0,
    [](int a, int b){return a|b;},
    [](int a, int b){return b;}
    );
    rep(i,n) {
        int d = s[i] - 'a';
        st.set(i,(int)(1 << d));
    }
    st.build();

    while(Q--) {
        int type;
        cin >> type;
        if(type == 1) {
            int j; char c;
            cin >> j >> c;
            j--;
            int d = c - 'a';
            st.change(j, (int)(1 << d));
        }
        if(type == 2) {
            int l,r;
            cin >> l >> r;
            l--; r--;
            cout << __builtin_popcount(st.query(l,r+1)) << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 7988
#include <stdio.h>
main(){
  int a,b,c,d,e,f,n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d%d",&a,&b,&c);
    a=a*a;
    b=b*b;
    c=c*c;
    d=a+b;
    e=b+c;
    f=c+a;
    if(d==c) printf("YES\n");
    else if(e==a) printf("YES\n");
    else if(f==b) printf("YES\n");
    else printf("NO\n");
  }
return 0; 
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
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;
}
///////////////////////////////////////////////////////////////

ll gcd(ll x, ll y) {
    if (x == 0) return y;
    return gcd(y%x,x);
}

ll lcm(ll x, ll y) {
    return x/gcd(x,y)*y;
}
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,M; cin >> N >> M;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    vector<int> C(N);
    auto B = A;
    rep(i,N) {
        while (B[i]%2 ==0) {
            B[i] /= 2;
            C[i]++;
        }
    }
    rep(i,N-1) {
        if (C[i] != C[i+1]) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll G = 1LL;
    rep(i,N) G = lcm(G,A[i]/2LL);
    ll k = M/G;
    ll ans = (k+1LL)/2LL;

    cout << ans << endl;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<math.h>
int main(void)
{
    double a,b,c,a1,b1,c1,x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&a1,&b1,&c1)!=EOF){
    x=(c*b1-c1*b)/(a*b1-a1*b);
    y=(a*c1-a1*c)/(a*b1-a1*b);
    if(fabs(x)<0.0001)x=0;
    if(fabs(y)<0.0001)y=0;
    printf("%.3f",x);
    printf(" %.3f\n",y);
    }
    return 0;
}

Measured memory_bytes: 652
#include <stdio.h>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(n);i++)

#define INF 1e9
#define MAX_N 100

int n, m;
int cost[MAX_N][MAX_N];
bool used[MAX_N];
int mincost[MAX_N];

using namespace std;

int prim(void)
{
    //init
    REP(i,n){
        used[i] = false;
        mincost[i] = INF;
    }
    //start from 0th vertex
    mincost[0] = 0; 
    //search
    int dist = 0;
    while(true){
        //search the edge with minimum cost
        int v = -1;
        REP(u,n) if(!used[u] && (v==-1||mincost[u]<mincost[v])) v = u;
        if(v == -1) break;
        //set v as used vertex
        used[v] = true;
        dist += mincost[v];
        //update minimum cost
        REP(u,n) mincost[u] = min(mincost[u], cost[v][u]);
    }
    return dist;
}

void solve(void)
{
    while(true){
        scanf("%d", &n);
        if(n==0) return;
        scanf("%d", &m);
        REP(i,n) REP(j,n) cost[i][j] = INF;
        REP(i,m){
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            cost[b][a] = cost[a][b] = d/100-1;
        } 
        printf("%d\n", prim());
    }
}

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

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

int main(){
  vector<int> T(5);
  int Min=9,last,Last,sum=0;
  
  for(int i=0;i<5;i++){
    cin >> T[i];
    if(T[i]%10 < Min && T[i]%10!=0){
      last = i;
      Min = T[i]%10;
    }
  }
  Last=T[last];
  T[last]=0;
  for(int i=0;i<5;i++){
    if(T[i]%10 == 0){
      sum +=T[i];
    }else{
      sum +=T[i] - T[i]%10 + 10;
    }
  }
  cout << sum+Last << endl;
  return 0;
}

Measured memory_bytes: 256
N,L,T = gets.split.map(&:to_i)
XW = (0...N).map{ 
  x,w = gets.split.map(&:to_f) 
  [x,w == 1 ? 1.0 : -1.0]
}
T2 = T.to_f - 0.25
C = ((T/L)+1)*L
Y = XW.map{ |x,w| (x + w*T2 + C)%L }

X,W = *XW[0]
#p C, X + W*T2, X + W*T2 + C, (X + W*T2 + C)%L, Y
Z = Y[0]
#p XW,X,W
D = XW[1..-1].map{ |x,w|
  next 0 if w == W
  d = case
  when w > W && x >= X
    x - X
  when w > W && x < X
    L - (X - x)
  when w < W && x >= X
    L - (x - X)
  else
    x - X
  end
  #p [x,w,d,T2*(w-W).abs]
  ((d + T2*2)/L).floor
}.inject(:+) || 0
SY = Y.sort
J = SY.index(Z)
I = (J - D.to_i*W + N) % N
puts (0...N).map{ |i| (SY[(i+I)%N] + 0.5).to_i % L }


Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
int b[26]={0};
int main(){
    char a[26];
    cin>>a;
    for(int i=0;i<strlen(a);i++){
        b[a[i]-'a']++;
    }
    for(int i=0;i<strlen(a);i++){
        if(b[i]>1){cout<<"no"<<endl; return 0;}
    }
    cout<<"yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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)*}
    };
}

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")
    };
}
//入力マクロここまで

const INI: i64 = -1;

fn cost(i: usize, h: &Vec<i64>, dp: &mut Vec<i64>) -> i64 {
    dp[i] = if i == 0 || i == 1 {
        0
    } else if i == 2 {
        (h[1] - h[2]).abs()
    } else if dp[i] != INI {
        dp[i]
    } else {
        std::cmp::min(
            cost(i - 1, h, dp) + (h[i] - h[i - 1]).abs(),
            cost(i - 2, h, dp) + (h[i] - h[i - 2]).abs(),
        )
    };
    dp[i]
}

fn main() {
    input! {
        n: usize,
        h: [i64;n],
    }

    let mut h = h;
    let mut t = vec![0];
    t.append(&mut h);
    let h = t;

    let mut dp = vec![INI; n + 1];

    println!("{}", cost(n, &h, &mut dp));
}

Measured memory_bytes: 12540
n = int(input())
r = ''
for i in range(1, n+1):
	if i % 3 == 0:
		r = r + ' ' + str(i)
		continue
	x = i
	while x != 0:
		if x % 10 == 3:
			r = r + ' ' + str(i)
			break
		x = x // 10
print(r)



Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[200009],i,j,zx,xc,pas,bo[200009];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    for(i=1; i<=a; i++) cin>>f[i];
    i=1;j=1;
    bo[i]=1;
    while(1){
        if(j==b+1){
            cout<<i;
            return 0;
        }
        if(bo[f[i]]==0){
            i=f[i];
            j++;
            bo[i]=j;
            continue;
        }
        //return 0;
        c=bo[i]-bo[f[i]]+1;
        b-=bo[i];
        d=b%c;
        e=f[i];
        while(d>0){
            d--;
            e=f[e];
        }
        cout<<e;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 6768
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9 + 7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4] ={ 1,0,-1,0 };
int dy[4] ={ 0,1,0,-1 };

int N, K;
string S;

signed main() {
	cin >> N >> S >> K;
	char c = S[K-1];
	rep(i, N){
		if(S[i] != c) S[i] = '*';
	}
	cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)

const ll maxn=1e5+5;
ll n, k, a[maxn], dp[maxn];

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

    cin>>n>>k;
    rep(i,1,n+1) cin>>a[i];
    dp[1]=0;
    rep(i, 2, n+1) {
       dp[i]=1e9;
       rep(j, max(1ll,i-k), i) dp[i]=min(dp[i], dp[j]+abs(a[j]-a[i]));
    }
    cout<<dp[n]<<"\n";
}


Measured memory_bytes: 1792
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
mod = 10**9+7
for i,ai in enumerate(a):
  chk = pow(2,n-1-i,mod)+(n-1-i)*pow(2,max(0,n-2-i),mod)
  chk %= mod
  ans += chk*pow(2,i,mod)*ai
  ans %= mod
print(ans*pow(2,n,mod)%mod)

Measured memory_bytes: 87756
#include <iostream>
#include <set>
using namespace std;
int main(){
  set<char> mySet;
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++){
    if(mySet.find(s[i]) == mySet.end()) mySet.insert(s[i]);
  }
  if(mySet.size()==2) cout<<"Yes";
  else cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include<stdio.h>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int chk;
long long int ans;
string s;


int main()
{
	cin >> s;
	int len = s.size();
	for (int i = len-1; i >=0; i--)
	{
		if (s[i] == 'B')
		{
			ans += len-1 - i - chk;
			chk++;
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 640