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

using namespace std;

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

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

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

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int n;
string alh="abcdefghij";
vector<string> ans;

void dfs(string a){
  if(a.size()==n){
    ans.push_back(a);
    return;
  }
  int ma=0;
  int m=a.size();
  REP(i, m){
    CHMAX(ma, a[i]-'a');
  }
  REP(i, min(ma+1, 10)+1){
    dfs(a+(alh[i]));
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  cin>>n;
  dfs("a");
  REP(i, ans.size()){
    cout<<ans[i]<<'\n';
  }
  return 0;
}


Measured memory_bytes: 9716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

ll POW(ll n, ll p) {
    ll ret = 1;
    for (ll x = n; p; p >>= 1, x = x * x % mod) {
        if (p & 1)ret = ret * x % mod;
    }
    return ret;
}
ll INV(ll n) { return POW(n, mod - 2); }

int main() {
    init();

    ll h, w, a, b; cin >> h >> w >> a >> b;
    ll m = h + w - 2;
    VL fact(m + 1);
    fact[0] = 1;
    eFOR(i, 1, m)fact[i] = fact[i - 1] * i % mod;

    ll ans = 0;
    FOR(x, b, w) {
        ll k = fact[x + h - a - 1] * INV(fact[x]) % mod * INV(fact[h - a - 1]) % mod;
        k = k * fact[w - x + a - 2] % mod * INV(fact[a - 1]) % mod * INV(fact[w - x - 1]) % mod;
        ans = (ans + k) % mod;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
#define MOD (1000000007)
int H,K,W,dp[10][101];
bool ok(int b){
    F(10)if(b&1<<i&&b&1<<(i+1))return 0;
    return 1;
}
int dyn(int u,int h){
    if(!h)return u+1==K;
    int&v=dp[u][h];
    if(~v)return v;
    v=0;
    F(1<<(W-1))if(ok(i))v=(v+dyn(i&1<<u?u+1:u&&i&1<<(u-1)?u-1:u,h-1))%MOD;
    return v;
}
int main(void){
    scanf("%d%d%d",&H,&W,&K),CL(dp,-1);
    printf("%d\n",dyn(0,H));
    return 0;
}


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

using namespace std;

const int nmax = 110;
const int inf = 0x3f3f3f3f;

int n, a[nmax];
long long sum = 0;

int source, sink;
vector<int> g[nmax];
int cap[nmax][nmax];
int flow[nmax][nmax];
int father[nmax];
int used[nmax];

bool bfs() {
  queue<int> q;
  for (int i = 1; i <= n + 2; i++) father[i] = -1;
  q.push(source);
  father[source] = 0;
  
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    
    if (node == sink) {
      break;
    }
    
    for (int y : g[node]) {
      if (father[y] != -1) continue;
      if (flow[node][y] < cap[node][y]) {
        father[y] = node;
        q.push(y);
      }
    }
  }
  
  return father[sink] != -1;
}

long long augment() {
  int added = inf;
  for (int i = sink; i != source; i = father[i]) {
    added = min(added, cap[father[i]][i] - flow[father[i]][i]);
  }
  if (added == inf) return 0;
  for (int i = sink; i != source; i = father[i]) {
    flow[father[i]][i] += added;
    flow[i][father[i]] -= added;
  }
  return added;
}

long long maxflow() {
  long long ans = 0;
  while (bfs()) {
    for (int vec : g[sink]) {
      if (father[vec] != -1 && flow[vec][sink] < cap[vec][sink]) {
        father[sink] = vec;
        ans += augment();
      }
    }
  }
  return ans;
}

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] > 0)
      sum += a[i];
  }
  
  source = n + 1;
  sink = n + 2;
  for (int i = 1; i <= n; i++) {
    for (int j = i + i; j <= n; j += i) {
      g[i].push_back(j);
      g[j].push_back(i);
      cap[i][j] = inf;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] < 0) {
      g[source].push_back(i);
      g[i].push_back(source);
      cap[source][i] = -a[i];
    }
    if (a[i] > 0) {
      g[sink].push_back(i);
      g[i].push_back(sink);
      cap[i][sink] = a[i];
    }
  }
  
  cout << sum - maxflow() << '\n';
  
  return 0;
}

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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 1e5 + 5;
ll dp[N][13];
ll mod = 1e9 + 7;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (fopen("WALKING.INP", "r")){
                freopen("WALKING.INP", "r", stdin);
                freopen("WALKING.OUT", "w", stdout);
        }
        string s;
        cin >> s;
        ll n = s.length();
        s = " " + s;
        dp[0][0] = 1;
        for (int i = 1; i <= n; i++){
                for (int j = 0; j < 13; j++){
                        if (s[i] == '?'){
                                for (int k = 0; k < 10; k++){
                                        dp[i][(j * 10 + k) % 13] += dp[i - 1][j];
                                        dp[i][(j * 10 + k) % 13] %= mod;
                                }
                        } else {
                                dp[i][(j * 10 + (s[i] - '0')) % 13] += dp[i - 1][j];
                                dp[i][(j * 10 + (s[i] - '0')) % 13] %= mod;
                        }
                }
        }
        cout << dp[n][5];
}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define fi first
#define se second
#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 rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll n,m;
  cin>>n>>m;
  ll ans = 0;
  if(n==2||m==2) ans = 0;
  else{
    ans= n*m;
    ans-=n*2;
    ans-=(m)*2-4;

  }
  print(abs(ans));
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    int N;
    cin >> N;
    long long res = 0;
    vector<vector<long long>> num(10, vector<long long>(10, 0));
    for (int n = 1; n <= N; ++n) {
        vector<int> d;
        int nn = n;
        while (nn) {
            d.push_back(nn % 10);
            nn /= 10;
        }
        int a = d[0];
        int b = d.back();
        if (!a || !b) continue;
        ++num[a][b];
    }
    for (int a = 1; a < 10; ++a) {
        for (int b = 1; b < 10; ++b) {
            res += num[a][b] * num[b][a];
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long long
using namespace std;

signed main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	sort(vec.begin(),vec.end());
	int answer = 100000000;
	for(int i = vec.at(0);i <= vec.at(N - 1);i++) {
		int count = 0;
		for(int j = 0;j < N;j++) {
			count += ( i - vec.at(j) ) * ( i - vec.at(j) );
		}
		answer = min(answer,count);
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		FastScanner br = new FastScanner();
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
		String n1 = br.nt();
		int n = Integer.parseInt(n1.substring(0,2));
		int n2 = Integer.parseInt(n1.substring(2,4));
		boolean flag1 = false;
		boolean flag2 = false;
		if(n>=1&n<=12)flag1=true;
		if(n2>=1&n2<=12)flag2=true;
		if(!flag1&!flag2)pw.println("NA");
		else if(flag1&!flag2)pw.println("MMYY");
		else if(!flag1&flag2)pw.println("YYMM");
		else if(flag1&flag2)pw.println("AMBIGUOUS");
		pw.close();
	}
}

class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner(String s) {
		try {
			br = new BufferedReader(new FileReader(s));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	public FastScanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	ArrayList<Integer>[] ng(int n, int e) {
		ArrayList<Integer>[] adj = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < e; i++) {
			int a = ni() - 1;
			int b = ni() - 1;
			adj[a].add(b);
			adj[b].add(a);
		}
		return adj;
	}

	Integer[] nIa(int n) {
		Integer[] arr = new Integer[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	int[] nia(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	Long[] nLa(int n) {
		Long[] arr = new Long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	long[] nla(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	String[] nsa(int n) {
		String[] arr = new String[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nt();
		}
		return arr;
	}

	String nt() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int ni() {
		return Integer.parseInt(nt());
	}

	long nl() {
		return Long.parseLong(nt());
	}

	double nd() {
		return Double.parseDouble(nt());
	}

}

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

int main(){
    int A,B,C;
    
    cin >> A >> B >> C;
    if(A<C && C<B || A>C && C>B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<String> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(sc.next());
        }
        System.out.println(set.size());
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 78668
Sin=input()
S=[int(Sin[i]) for i in range(len(Sin))]
#print(S)
def sums(a):
  n=len(a)
  if n==1:
    return a[0]
  else:
    s=0
    for i in range(n):
      s+=10**(n-i-1)*a[i]
    
    for i in range(n-1):
      t=0
      b=a[i+1:]
      c=a[:i+1]
      for j in range(i+1):
        t+=(10**(i-j))*c[j]
      n2=len(b)-1
      s+=t*(2**n2)+sums(b)
      
    return s
  
print(sums(S))

Measured memory_bytes: 3064
w = input()
w = sorted(w)

tmp = []
cnt = []
for l in w:
    if l not in tmp:
        tmp.append(l)
        cnt.append(1) 
    else:
        cnt[-1] += 1
flag = 0
for x in cnt:
    if x%2 != 0:
        flag = 1
        break
    else:
        pass
if flag == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
n = input()
a, b, c, d = int(n[0]), int(n[1]), int(n[2]), int(n[3])
A, B, C, D = n[0], n[1], n[2], n[3]
if a+b+c+d == 7:
    print(A+"+"+B+"+"+C+"+"+D+"="+"7")
elif a+b+c-d == 7:
    print(A+"+"+B+"+"+C+"-"+D+"="+"7")
elif a+b-c+d == 7:
    print(A+"+"+B+"-"+C+"+"+D+"="+"7")
elif a+b-c-d == 7:
    print(A+"+"+B+"-"+C+"-"+D+"="+"7")
elif a-b+c+d == 7:
    print(A+"-"+B+"+"+C+"+"+D+"="+"7")
elif a-b+c-d == 7:
    print(A+"-"+B+"+"+C+"-"+D+"="+"7")
elif a-b-c+d == 7:
    print(A+"-"+B+"-"+C+"+"+D+"="+"7")
else:
    print(A+"-"+B+"-"+C+"-"+D+"="+"7")


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  int ans=0;
  for(int i=0; i<3; i++) {
    if(s[i]==t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

class UnionFind {
    vector<int> par;
    int c;

  public:
    UnionFind(int n) : par(n, -1), c(n) {}
    int root(int x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
    int size(int x) { return -par[root(x)]; }
    int count() const { return c; }
    bool same(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) {
        if((x = root(x)) == (y = root(y))) return false;
        if(par[x] < par[y]) swap(x, y);
        par[y] += par[x];
        par[x] = y;
        return c--;
    }
};

int main() {
    ll n, q, p, a, b;
    cin >> n >> q;

    UnionFind tree(n);

    while(q--) {
        cin >> p >> a >> b;
        if(!p)
            tree.unite(a, b);
        else
            cout << tree.same(a, b) << "\n";
    }
}


Measured memory_bytes: 3120
import           Control.Monad
import qualified Data.Array.IO               as IO
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  n <- getInt
  as <- getIntVec n

  d <- VM.new (n+1)
  VM.write d 0 (0::Int)

  forM_ [1..n] $ \i -> do
    let ai = as V.! (i-1)
    t <- VM.read d (i-1)
    VM.write d i (t + ai)

  d' <- V.freeze d
  let total = d' V.! n

  let solve i res
        | i == n   = res
        | otherwise = let s = d' V.! i
                          diff = abs (total - 2*s)
                          res' = min res diff
                      in solve (i+1) res'

  print $ solve 1 (10^18::Int)


Measured memory_bytes: 10492
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<vector<int>> Alp(n, vector<int>(26, 0));
    rep(i, n) {
        string s;
        cin >> s;
        rep(j, s.size()) {
            Alp[i][(s[j] - 'a')]++; 
        }
    }
    vector<int> ans(26, INF);
    rep(i, 26) {
        rep(j, n) {
            ans[i] = min(ans[i], Alp[j][i]);
        }
    }
    
    rep(i, 26) cout << string(ans[i], 'a' + i);
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
bool cmp(string a,string b)
{
    return a+b<b+a;
}
int main() {
     vector<string> v;
     int n,l;
     cin>>n>>l;
     for(int i=0;i<n;i++)
     {
         string s;
         cin>>s;
         v.push_back(s);
     }
     sort(v.begin(),v.end(),cmp);
     for(int i=0;i<n;i++)
     cout<<v[i];
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
static bool[] isPrimes = makePrimeList(100000);//i-1が素数かどうか

	static void Main()
	{
		long n = long.Parse(Console.ReadLine());
    long answer = 1;
    long memo = 1;
    long factorNum = 0;
    List<long> factors = Factoring(n);
    for(long i = 0; i < factors.Count(); i++)
    {
      if(factors[(int)i] != factorNum)
      {
        answer *= memo;
        memo = factors[(int)i]-1;
        factorNum = factors[(int)i];
      }else
      {
        memo *= factors[(int)i];
      }
    }
    answer *= memo;
		Console.WriteLine(answer);
	}

  static List<long> Factoring(long originalNum)//引数をO(√n)で素因数分解。リストには同じ数も含む。
  {
    List<long> answers = new List<long>();
    for(long i = 2; i <= Math.Sqrt(originalNum); i++)
    {
      if(!isPrimes[i-1]) continue;//素数でないとき
      else
      {
        while(originalNum % i == 0)
        {
          originalNum /= i;
          answers.Add(i);
        }
      }
    }
    if(originalNum != 1) answers.Add(originalNum);
    return answers;
  }

  static bool[] makePrimeList(long maxPrime)//「引数1以上」max以下の素数判定。エラトステネスの篩を用いる。
  {
    bool[] isPrimes = new bool[maxPrime];//素数リスト
    isPrimes[0] = false;//1は素数でないのでfalse
    for(long i = 1; i < maxPrime; i++) isPrimes[i] = true;//素数と仮定してtrue
    
    for(long i = 2; i <= Math.Sqrt(maxPrime); i++)
    {
      if(isPrimes[i-1])
      {
        for (long j = i*2; j <= maxPrime; j+=i)
        {
          isPrimes[j-1] = false;//素数でないのでfalse
        }
      }
    }

    return isPrimes;
  }
  
}


Measured memory_bytes: 18384
def hondan(w,m):
    m_sum = b_lis[0]
    num = 0
    if w < max(b_lis):
        return False
    else:
        for i in range(len(b_lis) - 1):
            m_sum += b_lis[i + 1]
            if m_sum > w:

                m_sum = b_lis[i + 1]
                num += 1

        if num < m:
            return True
        else:
            return False
        
def nibutan(f_id,e_id,m):
    
    
    m_id = int((f_id + e_id) / 2)
    m_bo = hondan(m_id,m)


    if (f_id > e_id):
        return m_id + 1
    else:
        if m_bo:
            return(nibutan(f_id,m_id -1,m))
        elif not m_bo:
            return(nibutan(m_id + 1,e_id,m))
        else:
            return m_id + 1



while True:
    global w_lis
    b_lis = []
    w_lis = []
    dan_num = [0]

    m,n = map(int,input().split())
    if m == n == 0:
        break
    for i in range(n):
        num = int(input())
        b_lis.append(num)
    s_num = int(sum(b_lis) /m)

    print(nibutan(s_num,1500000,m) )

Measured memory_bytes: 7644
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {
			String[] in = sc.nextLine().split(" ");
			ArrayList<Integer> list = new ArrayList<Integer>();
			int n = in.length-1;
			int s = Integer.parseInt(in[0]);
			for(int i = 0 ; i < n; i++) {
				list.add(Integer.parseInt(in[i+1]));
			}
			
			double[][] dp = new double[1 << n][n];
			for(int i = 1; i < 1 << n; i++) {
				Arrays.fill(dp[i], 2 << 27);
			}
			for(int i = 0; i < n; i++) {
				dp[1 << i][i] = list.get(i);
			}
			for(int i = 1; i < 1 << n; i++) {
				for(int j = 0; j < n; j++) {
					for(int k = 0; k < n; k++) {
						if((i & (1 << k)) == 0) {
							dp[i | (1 << k)][k] = Math.min(dp[i | (1 << k)][k], dp[i][j] + Math.sqrt(Math.pow(list.get(j) + list.get(k), 2) - Math.pow(list.get(j) - list.get(k), 2)));
						}
					}
				}
			}
			double min = Integer.MAX_VALUE;
			
			for(int i = 0; i < n; i++) {
				double tmp = dp[(1 << n) -1][i] + list.get(i);
				if(min > tmp) {
					min = tmp;
				}
			}
			if(min <= s) {
				System.out.println("OK");
			}
			else {
				System.out.println("NA");
			}
			
			
			
			
		}
	}
	

}

Measured memory_bytes: 30316
from itertools import groupby
from numpy import cumsum


N, K = map(int, input().split())
S = input().strip()

if len(set(S)) == 1:
    print(N)
    exit()

# ランレングス圧縮
G = []
for k, v in groupby(S):
    G.append(len(list(v)))
# 1 0 1 0 1...の配列が欲しいので、
# 先頭、末尾が0ならダミーの要素をそれぞれ追加する
if S[0] == '0':
    G.insert(0, 0)
if S[-1] == '0':
    G.append(0)

cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)

ans = 0
gc = len(G)
w = min(gc, 3+(K-1)*2)
for i in range(0, gc-w+2, 2):
    ans = max(ans, cum[i+w]-cum[i])
print(ans)


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

int main() {
int n,x[100],y[100];
cin>>n;
for (int i = 0; i < n; ++i) cin>>x[i];
for (int i = 0; i < n; ++i) cin>>y[i];
double d[4];
for (int i = 0; i < 4; ++i) {d[i]=0.0;}
for (int p = 1; p <= 3; ++p) {
	for (int i = 0; i < n; ++i) {
		d[p]+=pow(fabs(x[i]-y[i]),p);
	}
	d[p]=pow(d[p],1.0/p);
}
for (int i = 0; i < n; ++i) {
	d[0]=(d[0]<fabs(x[i]-y[i])?fabs(x[i]-y[i]):d[0]);
}
printf("%lf\n",d[1]);
printf("%lf\n",d[2]);
printf("%lf\n",d[3]);
printf("%lf\n",d[0]);
}

Measured memory_bytes: 3340
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    n = int(input())
    d = defaultdict(int)
    for c in ascii_lowercase:
        d[c] = 100

    for _ in range(n):
        count = Counter(input())
        for c in ascii_lowercase:
            d[c] = min(d[c], count[c])

    ans = ""
    for k, v in sorted(d.items()):
        if v > 0:
            ans += k * v

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    N=STR()
    if N[0]==N[1]==N[2] or N[3]==N[1]==N[2]:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import math

number = int(input())

def traial_division(target):
    dest = int(math.sqrt(target))
    for i in range(2,dest):
        if target % i == 0:
            return False
    #targetは素数
    return True

while True:
    if traial_division(number) == True:
        print(number)
        break
    else:
        number = number + 1


Measured memory_bytes: 2940
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

//#include <vector>
//#include <set>
//#include <map>
//#include <iostream>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define swap(p,q) r=(p);(p)=(q);(q)=r
#define INF 1000000000000//10^12

int n;
int white[2010][2010];
int black[2010][2010];
int dp[2010][2010];

void init(int n){
	int i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			dp[i][j]=-1;
		}
	}
}

int search(int w,int b){
	int s,t;

	if(dp[w][b]!=-1) return dp[w][b];
	if(w==n&&b==n){
		return 0;
	}else if(w==n){
		dp[w][b]=search(w,b+1)+black[b+1][w];
	}else if(b==n){
		dp[w][b]=search(w+1,b)+white[w+1][b];
	}else{
		s=search(w+1,b)+white[w+1][b];
		t=search(w,b+1)+black[b+1][w];
	
		dp[w][b]=min(s,t);
	}
	return dp[w][b];
}

int main(void)
{
	//変数の宣言
//	int n;
	char color;
	int c[4010];
	int a[4010];
	int w[2010];
	int b[2010];
	int r;

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp,temp1,temp2;
	int max,min;
	int len;
	int sum=0;



	//データの読み込み
	scanf("%d",&n);
//	scanf_s("%d",&n);

	for(i=0;i<2*n;i++){
		scanf("\n%c %d",&color,&a[i]);
//		scanf_s("\n");
//		scanf_s("%c",&color);
//		scanf_s("%d",&a[i]);
		if(color=='W'){
			c[i]=0;
			w[a[i]]=i;
		}else{
			c[i]=1;
			b[a[i]]=i;
		}
	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	for(i=1;i<=n;i++){
		white[i][0]=w[i];
		black[i][0]=b[i];
	}

	for(i=1;i<=n;i++){
		for(j=1;j<i;j++){
			if(w[j]<w[i]) white[i][0]--;
			if(b[j]<b[i]) black[i][0]--;
		}
	}

	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(b[j]<w[i]){
				white[i][j]=white[i][j-1]-1;
			}else{
				white[i][j]=white[i][j-1];
			}

			if(w[j]<b[i]){
				black[i][j]=black[i][j-1]-1;
			}else{
				black[i][j]=black[i][j-1];
			}
		}
	}

/*	for(i=1;i<=n;i++){
		for(j=0;j<=n;j++){
			printf("black[%d][%d]=%d\n",i,j,black[i][j]);
		}
		for(j=0;j<=n;j++){
			printf("white[%d][%d]=%d\n",i,j,white[i][j]);
		}
	}*/

	init(n);
	ans=search(0,0);

/*	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			printf("dp[%d][%d]=%d\n",i,j,dp[i][j]);
		}
	}
	*/
	//	printf("計算部分終了\n");

	//出力

	printf("%d",ans);

	//	printf("結果の出力終了\n");


	return 0;
}



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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin >> s;

  ll k;
  cin >> k;
  
  ll cnt = 0;
  ll f_cnt = 0;
  ll now = 1;
  ll n = s.size();
  ll f_flag = true;
  REP1(i, n){
    if(s[i-1] != s[i]){
      if(f_flag){
        f_cnt = now / 2;
        f_flag = false;
      }
      else
        cnt += now / 2;
      now = 1;
    }
    else
      now++;
  }

  ll e_now = now;
  ll e_cnt = 0;
  bool sysflag = false;
  REP(i, n){
    if(s[i] != s[n-1]){
      sysflag = true;
      break;
    }
    else
      e_now++;
  }

  ll ans;
  if(s[0] != s[n-1])
    ans = k*(f_cnt+cnt+e_now/2);
  else if(sysflag)
    ans = k*cnt + (k-1)*(e_now/2) + now / 2 + f_cnt;
  else
    ans = n * k / 2;
  cout << ans << endl;


  
  
}


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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007

int H,W;
int dp[101][101];
string arr[101];

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);
  //freopen (".in","r",stdin);
  //freopen (".out","w",stdout);
  cin>>H>>W;
  for (int i=0;i<H;i++){
    cin>>arr[i];
    for (int j=0;j<W;j++)
      dp[i][j]=INF;
  }
  if (arr[0][0]=='#')
    dp[0][0]=1;
  else
    dp[0][0]=0;
  for (int i=0;i<H;i++)
    for (int j=0;j<W;j++){
      if (i+1<H){
	int change=0;
	if (arr[i][j]!=arr[i+1][j] && arr[i+1][j]=='#')
	  change=1;
	dp[i+1][j]=min(dp[i+1][j],dp[i][j]+change);
      }
      if (j+1<W){
	int change=0;
	if (arr[i][j]!=arr[i][j+1] && arr[i][j+1]=='#')
	  change=1;
	dp[i][j+1]=min(dp[i][j+1],dp[i][j]+change);
      }
    }
  cout<<dp[H-1][W-1]<<endl;
  return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = 0
if 500*a <= x:
    for i in range(a+1):
        for h in range(b+1):
            for j in range(c+1):
                if 500*i+100*h+50*j == x:
                    num += 1
else:
    for i in range((x//500)+1):
        for h in range(b+1):
            for j in range(c+1):
                if 500*i+100*h+50*j == x:
                    num += 1
print(num)

Measured memory_bytes: 9192
//17D8101003D 田野平 晃樹 TanoMero417 C++
#include <iostream>

using namespace std;

void printArray(int n, int a[]){
    for(int i=0;i<n;i++){
        cout << a[i];

        if(i<n-1){
            cout << " ";
        }
    }
    cout << endl;
}


int main(){
    int n;
    int a[1000];

    cin >> n;

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

    printArray(n,a);

    //メインループ
    for(int i=1; i<n; i++){
        int j;
        int tmp = a[i];

        for(j=i-1; j >= 0 && a[j] > tmp; j--){
            a[j+1] = a[j];
        }

        a[j+1] = tmp;

        printArray(n,a);
    }
    
    return 0;
}

/*実行結果
15 16
*/


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

int main () {
  int n;
  cin >> n;
  for (int i = 1; i < n+1; i++) {
    int x = i*1.08;
    if (x == n) {
      cout << i << endl;
      break;
    }
    else if (i == n)
      cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 8, MAX_M = 8 * 7 / 2;
bool G[MAX_N][MAX_N];
bool visited[MAX_N];
int N, M;

int dfs(int v) {
    bool all_visited = true;
    REP(i, N) if (!visited[i]) all_visited = false;
    if (all_visited) return 1;

    int ret = 0;
    REP(i, N) {
        if (!G[v][i]) continue;
        if (visited[i]) continue;
        visited[i] = true;
        ret += dfs(i);
        visited[i] = false;
    }
    return ret;
}

void solve() {
    fill(visited, visited + N, false);
    visited[0] = true;
    int ans = dfs(0);
    cout << ans << endl;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a][b] = G[b][a] = true;
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef vector<ll> Vl;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;



int n, a[200005];
ll x[200005], y[200005], ans;

int main() {

	cin >> n;

	rep(i, n) {
		cin >> a[i];
		x[a[i]]++;
	}

	rep(i, 200001) {
		y[i] = x[i] * (x[i] - 1) / 2;
		ans += y[i];
	}

	rep(i, n) {
		ans -= y[a[i]];
		ans += (x[a[i]] - 1) * (x[a[i]] - 2) / 2;
		cout << ans << endl;
		ans -= (x[a[i]] - 1) * (x[a[i]] - 2) / 2;
		ans += y[a[i]];
	}

	return 0;
}

Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
using namespace std;

const unsigned long long BASE = (unsigned long long)(1e9 + 7);

#define FROM_0(i, n) for(int i = 0; i < (n); i++)
#define FROM_S(i, s, e) for(int i = (s); i < (e); i++)
#define ITER_BEGIN_END(iter, vec) for(auto iter = vec.begin(); iter < vec.end(); iter++)

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    int num = n / x + (n % x == 0 ? 0 : 1);
    cout << num * t << endl;
    return 0;
}


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

int main() {

  int a, b;
  
  cin >> a >> b;
  
  if(a+b==15){
    cout << '+' <<endl;
  }else if(a*b==15){
    cout << '*' <<endl;
  }else{
    cout << 'x' <<endl;
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int a = sc.nextInt(), b = sc.nextInt();

		int num = 0;
		int time = 0;
		if(a >= b) {
			num = b;
			time = a;
		}else {
			num = a;
			time = b;
		}
		for(;time > 0; time--) {
			pw.print(num);
		}
		pw.close();

	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

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

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string s, t;
    char x, y;

    cin >> s >> t;

    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] == t[i]) continue;

        x = s[i];
        y = t[i];

        for (int j = 0; j < (int)s.size(); j++) {
            if (s[j] == x) {
                s[j] = y;
                continue;
            }
            if (s[j] == y) {
                s[j] = x;
            }
            if (j < i && s[j] != t[j]) break;
        }
    }
    if (s == t) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 776
//OPTIMIZATIONS
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
//#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//OPTIMIZATIONS
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long uu;
typedef long long int lll;
typedef unsigned long long int uuu;
using namespace std;

#define watch(x) cerr << "\n" \
					  << (#x) << " is " << (x) << endl
#define cel(x, y) 1 + ((x - 1) / y)
const double PI = 3.141592653589793238463;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;

/*
$alil03

URL: url

Solution Begins here
*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int len = s.length();
	for (int i = 0; i < len; i++)
	{
		int x = s[i] - 'A';
		x = (x + n) % 26;
		cout << (char)('A' + x);
	}
}

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

using namespace std;

#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define fi(i,x,n) for(i=x;i<n;++i)
#define f(n) for(int i=0;i<n;++i)
#define fr(i,x,n) for(i=x;i>=n;--i)
#define endl '\n'

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    int ans=700;
    cin>>s;
    ans+=(s[0]=='o'?100:0);
    ans+=(s[1]=='o'?100:0);
    ans+=(s[2]=='o'?100:0);
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = Integer.parseInt(sc.next());
    String s = sc.next();
    
    if(a >= 3200){
      System.out.println(s);
    }
    else System.out.println("red");
  }
}

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

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }

    for(int i=0;i+K<N;i++){
        if(A[i]<A[i+K]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }

    return 0;
}

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

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define delete _delete

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 1e6;
const ll mod = 1e9 + 7;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());

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

template <typename T> void vout(T s){cout << s << endl;exit(0);}

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

    ll n, d;
    cin >> n >> d;
    d *= 2;
    d++;

    cout << n / d + (n % d > 0) << "\n";

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input()); x = 0
dp = [[[[0]*4 for q in range(4)] for p in range(4)] for i in range(n-2)]
ng = ["012", "021", "102", "0112", "0132", "0312"]
for p in range(4):
    for q in range(4):
        for r in range(4):
            if str(p)+str(q)+str(r) not in ng:
                dp[0][p][q][r] += 1
for i in range(n-3):
    for p in range(4):
        for q in range(4):
            for r in range(4):
                for s in range(4):
                    if str(p)+str(q)+str(r)+str(s) not in ng and str(q)+str(r)+str(s) not in ng:
                        dp[i+1][q][r][s] += dp[i][p][q][r]
for p in range(4):
    for q in range(4):
        for r in range(4):
            x = (x+dp[-1][p][q][r])%(10**9+7)
print(x)

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define sqr(x) (x)*(x)
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll n,m;
    cin>>n>>m;
    ll a[m];
    ll sum=0;
    for(int i=0;i<m;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>n) cout<<-1<<endl;
    else cout<<n-sum<<endl;
    return 0;
}



Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define fo(i,a,b) for(register int (i)=(a);(i)<=(b);++(i))
#define rd read()
#define maxn 200001
#define gc getchar()
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define pb push_back
#define db double
#define pu puts(" ")
using namespace std;
const int p=998244353;
int read()
{
	int x=0,f=1;
	char ch=gc;
	while(!isdigit(ch))
	{
		if(ch=='-')f=-1;
		ch=gc;
	}
	while(isdigit(ch))x=x*10+ch-48,ch=gc;
	return x*f;
}
void print(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10);
	putchar(x%10+48);
}
int qp(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=(ll)ans*a%p;
		a=(ll)a*a%p;
		b>>=1;
	}
	return ans;
}
int main()
{
    int n=rd,k=rd;
    if(k==1)cout<<"0"<<endl;
    else cout<<n-k<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int a,b;cin >> a >> b;
	cout << max(0ll,a-b) << endl;
	return 0;
}

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

int a[100001], ans[100004];

int main(){
	int n, p = 0;
	scanf("%d", &n);
	for(int i = 1;i <= n;i++)scanf("%d", &a[i]);
	
	a[0] = -1;
	for(int i = 1;i <= n;i++){
		if(a[i-1] != a[i])ans[p]++;
		else ans[++p] = 1;
	}
	
	int res = 0;
	for(int i = 0;i < p+1;i++)
	res = max(res, ans[i]+ans[i+1]+ans[i+2]);
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3776