akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
	static int[] max = new int[11];
	static int[] min = new int[11];
	public static boolean judge(int n, int s){
		if( s < min[n] || s > max[n] ){
			return false;
		}
		return true;
	}

	public static int factorial(int n){
		if( n == 0 ){
			return 1;
		}
		return n*factorial(n-1);
	}
	
	public static int possible(int n, int s, boolean[] used){
		int count = 0;
		if( !judge(n, s) ){
			return 0;
		}
		if( n == 1 ){
			if( used[s] ){
				return 0;
			} else {
			/*	used[s] = true;
				for(boolean bl : used){
					System.out.print(bl + " ");
				}
				System.out.println();
				used[s] = false;*/
				return 1;
			}
		}
		for(int i = 0; i < 10; i++){
			if( !used[i] ){
				used[i] = true;
				count += possible(n-1, s-i, used);
				used[i] = false;
			}
		}
		return count;
	}
	
/*	public static void solve(int n, int s, boolean[] used, int count, boolean flag){
		if( !judge(n, s) ){
			return;
		}
		if( n == 1 ){
			if( !used[s] ){
				flag = true;
			}
			return;
		}
				
		for(int i = 0; i < 10; i++){
			if( !used[i] ){
				used[i] = true;
				solve(n-1, s-i, used, count);
				used[i] = false;
			}
		}
		System.out.println(count);
	}*/
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		for(int i = 1; i <= 10; i++){
			max[i] = max[i-1] + (10-i);
			min[i] = min[i-1] + (i-1);
		}
		int n = stdIn.nextInt();
		int s = stdIn.nextInt();
		while( n != 0 || s != 0 ){
			boolean[] used = new boolean[10];
			int count = 0;
			System.out.println(possible(n, s, used)/factorial(n));
			n = stdIn.nextInt();
			s = stdIn.nextInt();
		}
	}
}

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

int main()
{
  double a, b, c, d, e, f, x, y, t;
  while (cin >> a >> b >> c >> d >> e >> f){
    t = a * e - b * d;
    x = (e * c - f * b) / t;
    y = (a * f - c * d) / t;
    if (x == 0) x = 0;
    if (y == 0) y = 0;
    printf("%.3f %.3f\n", x, y);
  }
}

Measured memory_bytes: 1236
N, M = map(int, input().split())  # 複数数値入力
X = list(map(int, input().split()))  # リスト入力（数値）  map関数はリストの各要素に対して関数を適用してくれ
X.sort()

if N >= M:
    print(0)
else:
    list = list()
    last = 0
    flg = True
    for x in X:
        if flg == True:
            last = x
            flg = False
            continue

        list.append(x - last)
        last = x

    list.sort()

    for i in range(N-1):
        list.pop(-1)
    print(sum(list))


Measured memory_bytes: 13960
#include <stdio.h>
#include <math.h>

struct Point{
	double x;
	double y;
};

Point roll(Point div1,Point div2){
	Point tmp_start = { div2.x-div1.x,div2.y-div1.y };
	Point tmp_end = { tmp_start.x*cos(M_PI/3) -tmp_start.y*sin(M_PI/3),
			tmp_start.x*sin(M_PI/3) + tmp_start.y*cos(M_PI/3) };
	Point ret = { tmp_end.x + div1.x,tmp_end.y + div1.y };
	return ret;
}

void outPut(Point point){
	printf("%.8f %.8f\n",point.x,point.y);
}

void calc(Point left,Point right,int count){
	Point div1 = {	(2*left.x + right.x)/3,(2*left.y + right.y)/3 };
	Point div2 = {(2*right.x + left.x)/3,(2*right.y + left.y)/3	};
	Point peek = roll(div1,div2);

	if(count > 1){
		calc(left,div1,count-1);
		calc(div1,peek,count-1);
		calc(peek,div2,count-1);
		calc(div2,right,count-1);
	}else{
		outPut(left);
		outPut(div1);
		outPut(peek);
		outPut(div2);
	}
}

int main(){
	int n;
	Point left = {0,0},right = {100,0};
	scanf("%d",&n);
	if(n == 0){
		outPut(left);
		outPut(right);
	}else{
		calc(left,right,n);
		outPut(right);
	}
}


Measured memory_bytes: 2692
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX_V=205;

int N;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v){
	G[u].push_back(v);
	G[v].push_back(u);
}

bool dfs(int v){
	used[v]=true;
	for(int i=0; i<G[v].size();i++){
		int u=G[v][i], w=match[u];
		if(w<0 || !used[w] && dfs(w)){
			match[v]=u;
			match[u]=v;
          	return true;
		}
	}
	return false;
}

int bip_matching(){
	int res=0;
	for(int i=0; i<MAX_V; i++) match[i] = -1;
	for(int v=0; v < N; v++){
		if(match[v]<0){
			for(int i=0; i<MAX_V; i++) used[i] = 0;
			if(dfs(v)){res++;}
		}
	}
	return res;
}


int main(){
	cin>>N;
	int x[MAX_V], y[MAX_V];
	rep(i,2*N){
		cin>>x[i]>>y[i];
	}
	rep(i,N)rep(j,N)if(x[i]<x[N+j] && y[i]<y[N+j]){
		add_edge(i,N+j);
	}
	int ans=bip_matching();
	cout<<ans<<endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
while(1):
    H,W=map(int,input().split(" "))
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if i==0 or i==H-1 or j==0 or j==W-1:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) {
  for (auto &e : vec) cout << e << " \n"[&e==&vec.back()];
}

template <class T>
void OUTS(vector<vector<T>> &df) {
  for (auto &vec : df) OUTS(vec);
}

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) {
  for (auto &e : vec) cout << e << "\n";
}

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}
// }}} End

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

  VAR(int, N);

  vector<int> h(N+10);
  rep(i, N) {
    IN(h[i]);
  }

  h[N] = 0;
  int res = 0;
  while (true) {
    bool all_of_zero = true;
    reps(i, 1, N) {
      if (!h[i] && h[i-1]) ++res;
      if (h[i-1]) {
        --h[i-1];
        all_of_zero = false;
      }
    }
    if (all_of_zero) break;
  }

  OUTL(res);
  return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  int AC=0,WA=0,TLE=0,RE=0;
  for(int i=0; i<N; i++){
    cin>>S[i];
    if(S[i]=="AC") ++AC;
    else if(S[i]=="WA") ++WA;
    else if(S[i]=="TLE") ++TLE;
    else ++RE;
  }
  cout<<"AC x "<<AC<<endl;
  cout<<"WA x "<<WA<<endl;
  cout<<"TLE x "<<TLE<<endl;
  cout<<"RE x "<<RE<<endl;
}

Measured memory_bytes: 6316
#include <stdio.h>
#include <string.h>

int main(void)
{
	int a,b,max;
	scanf("%d%d",&a,&b);
	max=a+b;
	if(max<a-b){max=a-b;}
	if(max<a*b){max=a*b;}
	printf("%d\n",max);
	return 0;
}



Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N = int(readline())
    G = [list(map(int, readline().split())) for _ in range(N)]

    H = [[True] * N for _ in range(N)]
    for k in range(N):
        for i in range(N):
            for j in range(i + 1, N):
                if G[i][j] > G[i][k] + G[k][j]:
                    print(-1)
                    return
                if k not in (i, j) and G[i][j] == G[i][k] + G[k][j]:
                    H[i][j] = False

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            if H[i][j]:
                ans += G[i][j]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 43996
a,b=map(int,input().split())
c=0
for i in range (0,a+1):
  for j in range (0,a+1):
    if (i+j)==a and (i*2 + j *4) == b:
      c+=1
if c== 0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 9164
orders = 5.times.map{gets.to_i}.sort_by {|i| (10 - i.to_s[-1].to_i) % 10 }
cnt = 0

orders.each_with_index do |o,i|
  if i < 4
    sum_num = 10 - o.to_s[-1].to_i
    sum_num = 0 if o % 10 == 0

    cnt += o + sum_num
  else
    cnt += o
  end
end
puts cnt

Measured memory_bytes: 3836
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  lint res=0;
  vector<P> a(n);
  rep(i,n)cin>>a[i].first>>a[i].second;
  sort(a.begin(),a.end());
  int cur=0;
  rep(i,m){
      if(a[cur].second==0)++cur;
      a[cur].second-=1;
      res+=a[cur].first;
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 4744
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
struct UnionFind {
    int n;
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> group;
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
        n=N;
    }
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void calc(){
        group.resize(n,0);
        for(int i=0;i<n;i++){
            group[root(i)]++;
        }
    }
    int size(int x){
        return group[root(x)];
    }
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }
 
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
 
};

signed main(){
  int n,m;cin>>n>>m;
  UnionFind tree(n+1);
  vector<int> p(n);
  rep(i,n)cin>>p[i];
  rep(i,m){
    int x,y;cin>>x>>y;
    tree.unite(x,y);
  }
  int sum=0;
  rep(i,n){
    if(tree.same(p[i],i+1)){
      sum++;
    }
  }
  cout<<sum<<"\n";
  return 0;
}


Measured memory_bytes: 1792
S = gets.split("")
K = gets.chomp.to_i

# 5000兆 = 10の15乗 * 5
# AAA = 5000000000000000

# 2
# 1日後 22
# 2日後 2222
# 3日後 22222222
# 10日後　2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222

one_count = 0
S.each do |ss|
  break unless ss == "1"
  one_count += 1
end

if S.count == S.count("1") || one_count >= K
  puts "1"
else
  v = S.select { |v| v != "1" }.first
  puts v
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	int n, m, X, Y;
	cin >> n >> m >> X >> Y;
	VI x(n), y(m);
	REP(i, n) { cin >> x[i]; }
	REP(i, m) { cin >> y[i]; }

	sort(ALL(x));
	sort(ALL(y));
	int max = *(--x.end());
	int min = *y.begin();

	if (std::max(max, X) < std::min(min, Y)) {
		cout << "No War" << endl;
	} else {
		cout << "War" << endl;

	}

}

Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define forsaken
#ifdef forsaken
  #define dbg(args...) do {cout << #args << " : "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
#define IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const int max_n=100005;
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
	inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
int n,m,c;
int b[max_n];
int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=m;i++)scanf("%d",b+i);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int res=0;
        for(int j=1;j<=m;j++)
        {
            int x;
            scanf("%d",&x);
            res+=x*b[j];
        }
        res+=c;
        if(res>0)ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
SL = len(S)
TL = len(T)

# 置換不要なパターン
for i in range(SL - TL + 1):
    PS = S[i:TL + i]
    if PS == T:
        print(S.replace('?', 'a'))
        exit()

S = list(S)
SR = S[::-1]
O_SR = SR[:]
TR = T[::-1]

for i in range(0, SL - TL + 1):
    PSR = SR[i:TL + i:]
    equal = True
    for s, t in zip(PSR, TR):
        if s == t or s == '?':
            pass
        else:
            equal = False
            break
    if equal:
        for j, t in zip(range(i, TL + i), TR):
            SR[j] = t
        break

if SR == O_SR:
    print("UNRESTORABLE")
else:
    print(''.join(SR[::-1]).replace('?','a'))


Measured memory_bytes: 63980
s = input()
size = len(s)

totals = []

def total(n):
  tmp = int(s[-1 * n:])
  
  for i in range(n-1):
    tmp += int(s[-1 * n:-1 * (i+1)]) * 2**i + totals[i]
    
  totals.append(tmp)


for i in range(size):
  total(i+1)

print(totals[size - 1])


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

int main()
{
	int prime[5*100001];
	for (int i = 0; i < 5*100001; ++i)
	{
		prime[i] = 1;
	}
	prime[0] = prime[1] = 0;
	for (int i = 0; i < 5*100001; ++i)
	{
		if(prime[i])
		{
			for (int j = i + i; j < 5*100001; j += i)
			{
				prime[j] = 0;
			}
		}
	}

	int x;
	cin >> x;
	for (int i = x; i < 5*100001; ++i)
	{
		if (prime[i])
		{
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, a, b;
    cin >> n >> a >> b;
    ll minv = a * (n - 1) + b;
    ll maxv = a + b * (n - 1);
    if (((n == 1) && (a != b)) || (a > b)) {
        cout << 0 << endl;
    }
    else {
        cout << (maxv - minv + 1) << endl;
    }
    return 0;
}


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

//素数判定
bool isPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2){
    if (num % i == 0) return false;
  }
  return true;
}

int main(){
  ll n,k,q;
  cin >> n >> k >> q;
  
  vector<int> player(n);
  rep(i,n) player[i] = k-q;
  
  rep(i,q){
    int answer = 0; cin >> answer;
    player[answer-1]++;
  }
  
  rep(i,n){
    if(player[i]>0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

#define NDEBUG
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll solve(int N, int K, vi& a) {
    vll acc(N+1, 0);
    rep(i,N) acc[i+1] = acc[i] + (ll)a[i];
    vll b;
    int P = N*(N+1) / 2;
    b.reserve(P);
    repC2(i,j,N+1) b.pb(acc[j] - acc[i]);
    sort(ALL(b));
    ll ans = 0;
    for (ll i=39,m=1LL<<39LL; i>=0; --i,m>>=1LL) {
        int cnt = 0;
        rep(i,P){
            if (b[i] & m) {
                ++cnt;
            }
        }
        if (cnt >= K) {
            ans |= m;
            rep(i,P) if (!(b[i] & m)) b[i] = 0;
        } else {
        }
    }
    return ans;
}

int main() {
    int N,K; cin >> N >> K;
    vi a(N);
    rep(i,N) cin >> a[i];
    cout << solve(N,K,a) << endl;
    return 0;
}


Measured memory_bytes: 4224
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[]
d=0
count=0
for i in range(0,n):
    a.append(input().split())

for i in range(0,n):
    for j in range(0,m):
        d = d + int(a[i][j])*int(b[j])
    if d+c>0:
        count=count+1
    d=0

print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  ll L,R;
  cin >> L >> R;

  if(R-L>673){cout << 0 << endl; return 0;}
  if(L % 673 > R % 673){cout << 0 << endl; return 0;}

  int i,j;
  int x = L % 2019;
  int y = R % 2019;
  int ans = 2019;
  int tmp = 0;

  for(i=x;i<y;i++){
    for(j=i+1;j<=y;j++){
      tmp = (i*j)%2019;
      if(tmp < ans){ans = tmp;}
    }
  }

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		sc.nextLine();

		String[][] board = new String[H][W];

		for (int i = 0; i < H; i++) {
			board[i] = sc.nextLine().split("");
		}

		int dx[] = {1,0,-1,0};
		int dy[] = {0,1,0,-1};
		int cnt = 0;
		boolean ans = true;
		check:for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cnt = 0;
				if ("#".equals(board[i][j])) {
					for (int d = 0; d < 4; d++) {
						int ni = i + dy[d];
						int nj = j + dx[d];
						if (ni < 0 || H <= ni) {
							continue;
						}
						if (nj < 0 || W <= nj) {
							continue;
						}
						if ("#".equals(board[ni][nj])) {
							cnt ++;
						}
					}
					if (cnt == 0) {
						ans = false;
						break check;
					}
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

typedef long long ll;
# define  pii pair<ll,ll> 
# define pb push_back
# define f first 
# define s second 


int main() {
int n;
cin>>n;
vector<int> v(n) ;

for(int i=0;i<n;i++)
{
    cin>>v[i];
    
}
//cout<<v[3]<<endl;
int len=0;
int MAX=INT_MIN;
for(int i=0;i<n-1;i++)
{
    if(v[i]>=v[i+1]) {len++;//cout<<"i "<<i<<endl;
        //cout<<"lr "<<len<<endl;
    }
    else{ //cout<<"len"<<endl;
    if(MAX<len) MAX=len ;len=0;}
    
}
if(MAX<len) MAX=len ;
cout<<MAX<<endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S=sc.next();
        if(S.length()==2){
        System.out.println(S);
        return;
        }
        char[] s =S.toCharArray();
        
       for(int i=2;i>=0;i--){
       System.out.print(s[i]);
       }
System.out.println();
    }
}


Measured memory_bytes: 22868
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
using namespace std;

int main() {
	int N, x[101],y[101],h[101],t;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> h[i];
		if (h[i] != 0)t = i;
	}
	for (int i = 0; i <=100; i++) {
		for (int j = 0; j <= 100; j++) {
			int H = h[t] + abs(x[t] - i) + abs(y[t] - j);
			bool z = 1;
			for (int k = 0; k < N; k++) {
				if (h[k] != max(0,H - abs(x[k] - i) - abs(y[k] - j))) {
					z = 0; break;
				}
			}
			if (z) {
				cout << i << " " << j << " " << H << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define mod 1000000007
#define inf 1e17
const ll lmax=INT_MAX;
using namespace std;

int main() 
{ 
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    int  dp[n+1][m+1];
    for(int i=0;i<=n;i++)
    {
      for(int j=0;j<=m;j++)
      {
         if(i==0 || j==0)
         {
            dp[i][j] = 0;
         }
         else if(s[i-1]==t[j-1])
         {
            dp[i][j] = dp[i-1][j-1]+1;
         }
         else
         {
            dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
         }
      }
    }
   int i = n,j=m;
   string str="";
   while(i>0 && j>0)
   {
      if(s[i-1]==t[j-1])
      {
         str = str + s[i-1];
         i--;
         j--;
      }
      else
      {
         if(dp[i-1][j] > dp[i][j-1])
         {
            i--;
         }
         else
         {
            j--;
         }
      }
   }
    reverse(str.begin(),str.end());
    cout<<str<<endl;
} 

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

int main(){
    string S;
    cin>>S;
    ll res=0;
    ll sum=0;
    for(int i=0;i<3;i++) {
        if(S[i]=='R')sum+=1;
        else{
            res=max(res,sum);
            sum=0;
        }
    }
    res=max(res,sum);
    cout<<res;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    int idx = -1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        if (a == 1) {
            idx = i;
        }
    }

    int res = 1000000000;
    for (int i = 0; i < k; i++) {
        int l = idx - i;
        int r = idx - i + k - 1;

        if (l < 0 || n - 1 < r) {
            continue;
        }

        int cl = l;
        int cr = n - r - 1;

        int re = (cl + k - 2) / (k - 1) + (cr + k - 2) / (k - 1) + 1;
        if (res > re) {
            res = re;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char num[1005];
    int sum=0;
    while(1)
    {
        scanf("%s",num);
        sum=0;
        if (num[0]=='0') break;
        int i, sz=strlen(num);
        for(i=0;i<sz;i++)

        {
            sum+=num[i] - '0';
        }

    printf("%d\n",sum);
}
}



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

int main() {
  int k;
  string s;
  cin >>k >>s;
  if(k<s.size()) cout << s.substr(0,k) << "..." <<endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
string s,c;
int ans;
int main(){
	cin>>s>>c;
    for(int i=0;i<=2;i++)if(s[i]==c[i])ans++;
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int main(){
  string s; cin >> s;
  if(s[2]==s[3]&&s[4]==s[5]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds; 
 
#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define vii vector<vector<ll>>
#define vpi vector<pii>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
#define umap unordered_map<ll,ll>
#define mmap map<ll,ll>
#define mm 998244353

// typedef tree<pii,null_type,less<pii>,rb_tree_tag,
// tree_order_statistics_node_update>PBDS; 



int32_t main() 
{ 
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif  
   

    ll t;
    t=1;
    // cin>>t;
    while(t--){
     ll n,x,m;
     cin>>n>>x>>m;
     
     ll i = x;

     umap mpp;
     ll cnt = 1;

     // finding the starting point and length of the loop
     while(mpp[i]==0){
      // cout<<i<<" ";
       mpp[i] = cnt;
       i = (i*i)%m;
       cnt++;
     }
     // cout<<i<<" ";

     ll start = mpp[i],length = cnt-mpp[i];

     // cout<<start<<" "<<length<<" ";

     ll ans1 = 0;

     ll tt = x;
     for(int j=1;j<start;j++){ans1+=tt;
      tt = (tt*tt)%m;}

    ll remaining = (n-start+1)%length;

     ll ans2 = 0;
     ll ans3 = 0;

     for(int j=1;j<=length;j++){
      ans2+=tt;
      if(j==remaining)ans3 = ans2;
      tt = (tt*tt)%m;
     }

     // cout<<ans1<<"\n";


     cout<<ans1+ans3+ans2*((n-start+1)/length);








     

     

    

     

  






    }
      
     
      

      

    

    
return 0;
}     



Measured memory_bytes: 5276
#include<bits/stdc++.h>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin>>N;
  long long int A[N],ame[N];
  REP(i,N)cin>>A[i];
  ame[0]=0;
  REP(i,N){
    if(i%2==1)ame[0]-=A[i];
    else ame[0]+=A[i];
  }
  
  RREP(i,1,N){
    ame[i]=(A[i-1]-ame[i-1]/2)*2;
  }
  
  REP(i,N)cout<<ame[i]<<" ";
  
  return 0;
}

Measured memory_bytes: 2944
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b, c, p[3], min=1000000;

	cin>>a>>b>>c;

	p[0]=a+b; p[1]=b+c; p[2]=c+a;

	rep(i, 3){
		if(min>p[i]) min=p[i];
	}
	cout<<min<<endl;
}



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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#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 MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define C(x) cout << x << endl //テスト出力

//関数
//nCkの計算の関数(呼び出しは[cbn])
ll cbn(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
// a^n mod を計算する
ll powmod(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
//２つの最大公約数
int gcb(int a, int b){
    if(a < b){
        int x = a;
        a = b;
        b = x;
    }
    int amari = a % b;
    if(amari == 0) return b;

    return gcb(b, amari);
}
//３つの最大公約数
int gcb_3(int a, int b, int c){
    return gcb(gcb(a, b), c);
}
/*-----------------------------ここから-----------------------------*/

int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string x; cin >> x;
cout << "ABC"+x;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <stdint.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <vector>

using namespace std;

typedef int64_t ll; //PRId64 SCNd64

#define NMAX 100000

vector<int> par(NMAX, 0);
vector<int> sz(NMAX, 0);

void dsu_makeset(const int u)
{
    par[u] = -1;
    sz[u] = 1;
}

int dsu_find(const int u)
{
    if(par[u] < 0){
        return u;
    }else{
        return par[u] = dsu_find(par[u]);
    }
}

bool dsu_union(const int u, const int v)
{
    const int root_u = dsu_find(u);
    const int root_v = dsu_find(v);
    if(root_u == root_v){
        return false;
    }
    if(par[root_u] < par[root_v]){
        par[root_v] = root_u;
        sz[root_u] += sz[root_v];
    }else{
        if(par[root_u] == par[root_v]){
            par[root_v] --;
        }
        par[root_u] = root_v;
        sz[root_v] += sz[root_u];
    }
    return true;
}

int main(int argc, char **argv)
{
    int N, M; // N 2 1e5 M 1 1e5. 1 <= Ai < Bi <= N
    scanf("%d%d", &N, &M);
    vector<int> A(M), B(M);
    vector<vector<int> > adj(N);
    for(int i = 0; i < M; i++){
        scanf("%d%d", &A[i], &B[i]);
        A[i] --;
        B[i] --;
    }

    vector<ll> cnt(M + 1, 0); // <= C(N, 2) < N * N = 1e10
    
    for(int i = 0; i < N; i++){
        dsu_makeset(i);
    }

    //build
    for(int i = M - 1; i >= 0; i--){
        int u = A[i], v = B[i];
        int up = dsu_find(u);
        int vp = dsu_find(v);
        if(up != vp){
            //merge
            cnt[i] = ((ll)sz[up]) * sz[vp];
            dsu_union(up, vp);
        }
        cnt[i] += cnt[i + 1];
    }
    ll res = 0;
    for(int i = 0; i < M; i++){
        res += cnt[i] - cnt[i + 1];
        printf("%" PRId64 "\n", res);
    }
    
    return 0;
}

Measured memory_bytes: 6016
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [input() for _ in range(n)]
ok = True
if len(a) != len(set(a)):
    ok = False
for i in range(n-1):
    if a[i][-1] != a[i+1][0]:
        ok = False
print('Yes' if ok else 'No')

Measured memory_bytes: 66540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _cin      ios_base::sync_with_stdio(0);  cin.tie(0);
#define READ      freopen("input.txt", "r", stdin);
#define WRITE     freopen("output.txt", "w", stdout);
#define endl "\n"
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<ll> >
#define vll vector<ll>
#define mint map<ll,ll>
#define sz(x) (ll)x.size()
#define sll set<ll>
#define pll pair<ll,ll>
#define F first
#define S second
const ll MAx = 1000004;

int main() {

	_cin
	// READ
	// WRITE
	ll n, k;
	cin >> n >> k;
	ll a[n + 1];
	ll dp[n + 1];
	rep(i, 1, n + 1) {
		cin >> a[i];
		dp[i] = LONG_MAX;
	}
	dp[1] = 0;
	rep(i, 2, n + 1) {
		rep(j, 1, k + 1) {
			if (j < i) {
				dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));

			} else break;
		}
	}
	cout << dp[n] << endl;


}

Measured memory_bytes: 5184
//A
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		int a = 0;

		int b = 0;

		for(int i=0;i<S.length();i++) {

			if(i%2==0 && S.charAt(i)=='1') a++;

			if(i%2==1 && S.charAt(i)=='0') a++;

		}

		for(int i=0;i<S.length();i++) {

			if(i%2==0 && S.charAt(i)=='0') b++;

			if(i%2==1 && S.charAt(i)=='1') b++;

			if(b>a) break;
		}

		int ans = Math.min(a, b);

		System.out.println(ans);
	}

}


Measured memory_bytes: 24452
#include<bits/stdc++.h>
using namespace std;
char s[11];
int sum,ans;
int main()
{
	scanf("%s",s);
	int len=strlen(s);
	for (int i=0; i<len; i++)
		if (s[i]=='A' || s[i]=='G' || s[i]=='C' || s[i]=='T')
		{
			sum++;
			if (sum>ans) ans=sum;
		}
		else sum=0;
	cout<<ans;
	return 0;
}

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

const int kN = 205;

std::list<int> vec;

int main() {
	int n, m, odd_cnt = 0, bk = 0, cnt = 0, x;
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; ++i) {
		scanf("%d", &x);
		if(x % 2 == 1) {
			if(!odd_cnt) bk = x;
			else if(odd_cnt == 1) vec.push_front(x);
			++odd_cnt;
		} else vec.push_back(x);
	}
	if(m == 1 && x <= 2) { printf("%d\n1\n%d\n", x, x); return 0; } 
	if(m == 1) { printf("%d\n2\n%d %d", x, x - 1, 1); return 0; }
	if(odd_cnt > 2) { printf("Impossible"); return 0; }
	if(bk) vec.push_back(bk);
	for(int i : vec) printf("%d ", i);
	--vec.front(); ++vec.back();
	for(int i : vec) if(i) ++cnt;
	printf("\n%d\n", cnt);
	for(int i : vec) if(i) printf("%d ", i);
	return 0;
}

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

typedef long long ll;
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 < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

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


    if(a<3200) s = "red";
    cout << s << endl;
}



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

int main(){
    int N;
    cin >> N;

    int a, b, c;
    a = N / 100;
    b = (N - a * 100) / 10;
    c = N % 10;

    if(a == b && b == c){
        cout << N << endl;
    }else if(a < b){
        cout << (a + 1) * 100 + (a + 1) * 10 + (a + 1) << endl;
    }else if(a > b){
        cout << a * 100 + a * 10 + a << endl;
    }else if(b > c){
        cout << a * 100 + a * 10 + a << endl;
    }else{
        cout << (a + 1) * 100 + (a + 1) * 10 + a + 1 << endl;
    }
}

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

int main() {

    int a, p;
    cin >> a >> p;

    int ret = a * 3 + p;

    cout << ret / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N, W = map(int, input().split())
    WV = [tuple(map(int, input().split())) for _ in range(N)]
    cur = {0: 0}
    for w, v in WV:
        keys = sorted(cur.keys(), reverse=True)
        for k in keys:
            if k + w > W:
                continue
            cur[k + w] = max(cur[k] + v, cur.get(k + w, 0))
    return max(cur.values())

print(main())


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, M, K;
  cin >> N >> M >> K;
  for (ll i = 0; i <= N; ++i) {
    for (ll j = 0; j <= M; ++j) {
      ll temp = i * j + (N - i) * (M - j);
      if (temp == K) {
        cout << "Yes" << "\n";
        return 0;
      }
    }
  }
  cout << "No" << "\n";
}


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

#define int long long
#define uint unsigned int
#define pii pair<int, int>

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

#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)

#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))

#define PW(n) (1LL << (n))

using namespace std;

template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline void SORT(T &a) { sort(a.begin(), a.end()); }
template <class T> inline void REV(T &a) { reverse(a.begin(), a.end()); }
template <class T> inline void UNI(T &a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }

template <class S, class T> ostream& operator << (ostream& os, const pair<S, T> v) {
  os << "(" << v.first << ", " << v.second << ")"; return os;
}

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

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

int N;
int dp[110][5][5][5][5];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  dp[0][0][0][0][0] = 1;
  REP(i, N) REP(p, 5) REP(q, 5) REP(r, 5) REP(s, 5) {
    if (q == 1 && r == 3 && s == 2) continue;
    if (p == 1 && r == 3 && s == 2) continue;
    if (p == 1 && q == 3 && s == 2) continue;
    if (p == 1 && q == 3 && r == 2) continue;
    if (q == 3 && r == 1 && s == 2) continue;
    if (q == 1 && r == 2 && s == 3) continue;
    if (p == 3 && q == 1 && r == 2) continue;
    if (p == 1 && q == 2 && r == 3) continue;
    FOR(j, 1, 5) (dp[i+1][q][r][s][j] += dp[i][p][q][r][s]) %= MOD;
  }
  int ans = 0;
  REP(p, 5) REP(q, 5) REP(r, 5) REP(s, 5) {
    if (q == 1 && r == 3 && s == 2) continue;
    if (p == 1 && r == 3 && s == 2) continue;
    if (p == 1 && q == 3 && s == 2) continue;
    if (p == 1 && q == 3 && r == 2) continue;
    if (q == 3 && r == 1 && s == 2) continue;
    if (q == 1 && r == 2 && s == 3) continue;
    if (p == 3 && q == 1 && r == 2) continue;
    if (p == 1 && q == 2 && r == 3) continue;
    (ans += dp[N][p][q][r][s]) %= MOD;
  }
  cout << ans << endl;

  return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a < b){
    cout << "a < b" << endl;
  }
  else if(a > b){
    cout << "a > b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }
}  
    



Measured memory_bytes: 3068
n=int(input())
s=input()
ans=0
a=[0]*3
f=0

for a[0] in range(10):
    for a[1] in range(10):
        for a[2] in range(10):
            #print("pass=",a[0],a[1],a[2])
            f=0
            for ss in s:
                #print(ss,a[f],f)
                if ss == str(a[f]):
                    f+=1
                    if f==3:
                        ans+=1
                        break
print(ans)


Measured memory_bytes: 43228
#include <stdio.h>
#define ll long long
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	ll s=1;
	while(n)s=s*m--%MOD,n--;
	printf("%lld\n",s);
}


Measured memory_bytes: 2108
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main(void)
{
     int a,b,i,j,k,n,m;
     scanf("%d%d",&n,&m);
     a=m;
     k=1;
     while(a>=10)
     {
          k=k*10;
          a/=10;
     }
     k=k*10;
     n=n*k+m;
     m=sqrt(n);
     if(m*m==n)
          printf("Yes\n");
     else
          printf("No\n");
     return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m;
int color[100010];
vector<int> G[100010];
int d = 0;
bool f = true;

void dfs(int v, int c){
    color[v] = c;
    d++;
    rep(i, 0, G[v].size()){
        if(color[G[v][i]] == c) f = false;//
        if(color[G[v][i]] == 0) dfs(G[v][i], -c);
    }
}

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u]. push_back(v);
        G[v]. push_back(u);
    }
    int ca = 0, cb = 0, cc = 0;
    rep(i, 0, n){
        d = 0; f = true;
        if(color[i] == 0){
            dfs(i, 1);
            if(d == 1) ca++;
            else if(f == true) cb++;
            else cc++;
        }
    }
    cout << cb * cb + (cb + cc) * (cb + cc) + ca * ca + 2 * ca * (n - ca) << endl;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    string S;

    cin >> S;

    cout << S.substr(0,3) << endl;
}


Measured memory_bytes: 3628