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

int UF[100000];
void init();
void u(int,int);
int  f(int);
void init(){int i;for(i=0;i<100000;i++)UF[i]=i;}
void u(int a,int b){UF[f(a)]=UF[f(b)];}
int  f(int c){if(c!=UF[c])UF[c]=f(UF[c]);return UF[c];}

int cities[100000][3];
int road[200000][3];

int comp_0(const void *a, const void *b){
    return (*(int (*)[3])a)[0] - (*(int (*)[3])b)[0];
}
int comp_1(const void *a, const void *b){
    return (*(int (*)[3])a)[1] - (*(int (*)[3])b)[1];
}

int main(){
    int i,n,x,y,cost;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d",&x,&y);
        cities[i][0]=x;
        cities[i][1]=y;
        cities[i][2]=i;
    }
    qsort(cities, n, sizeof(int[3]), comp_0);
    for(i=0;i<n-1;i++){
        road[i][0]=cities[i+1][0]-cities[i][0];
        road[i][1]=cities[i][2];
        road[i][2]=cities[i+1][2];
    }
    qsort(cities, n, sizeof(int[3]), comp_1);
    for(i=0;i<n-1;i++){
        road[i+n-1][0]=cities[i+1][1]-cities[i][1];
        road[i+n-1][1]=cities[i][2];
        road[i+n-1][2]=cities[i+1][2];
    }
    qsort(road, 2*n-2, sizeof(int[3]), comp_0);

    init();
    cost=0;
    for(i=0;i<2*n-2;i++){
        x=road[i][1];
        y=road[i][2];
        if(f(x)!=f(y)){
            u(x,y);
            cost+=road[i][0];
        }
    }
    printf("%d\n",cost);
    return 0;
}

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

const int MAXN = 1005;
const int MAXV = MAXN*(MAXN-1)/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i, int j){
    if(i>j)swap(i,j);
    return id[i][j];
}
bool visited[MAXV];
bool calculated[MAXV];//ループ検出(計算途中か？)
int dp[MAXV];//max length of path from v
int dfs(int v){
    if(visited[v]){
        if(!calculated[v])return -1;
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for(int u : to[v]){
        int res = dfs(u);     
        if(res == -1)return -1;
        dp[v] = max(dp[v],res+1);
    }
    calculated[v] = true;
    return dp[v];
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n,vector<int>(n-1));
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    //各試合にidを振る
    rep(i,n)rep(j,n){
        if(i<j){
            id[i][j] = V++;
        }
    }
    rep(i,n){
        rep(j,n-1){
            a[i][j] = toId(i,a[i][j]);//idに書き換え
        }
        rep(j,n-2){
            to[a[i][j+1]].push_back(a[i][j]);//逆向きに辺を張る
        }
    }
    int ans = 0;
    //好きな頂点からdfs
    rep(i,V){
        int res = dfs(i);
        if(res == -1){
            puts("-1");
            return 0;
        }
        ans = max(ans,res);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 38528
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26


for d in range(1,D+1):
    ans=[]
    for choice in range(1,27):
        ans_tmp=0
        ans_tmp+=s[d-1][choice-1]
        for i in range(26):
            if i+1==choice:
                continue
            ans_tmp-=c[i]*(d-last[i]+1)
        ans.append((ans_tmp,choice))
    _,case=max(ans)
    last[case-1]=d
    print(case)



Measured memory_bytes: 9420
H, N = map(int, input().split())
a, b = zip(*(list(map(int, input().split())) for _ in range(N)))
maxA = max(a)

inf = float("inf")
dp = [inf] * (H+maxA+1)
dp[0] = 0

for j in range(N):
    for i in range(a[j], H+maxA+1):
        dp[i] = min(dp[i], dp[i-a[j]]+b[j])

print(min(dp[H:]))

Measured memory_bytes: 50948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	int n;
	cin>>n;
	if(n==1){
		cout<<"Hello World";
	}
	else{
		int a,b;
		cin>>a>>b;
		cout<<a+b;
	}
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n,m;
	cin >> n >> m;
	if(n==0&&m==0) break;
	vector<int> a(n);
	REP(i,n) cin >> a[i];
	int sum = 0;
	REP(i,n) sum += a[i];
	sort(RALL(a));
	for(int i=m-1;i<n;i+=m){
	    sum -= a[i];
	}
	cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Graph Start
struct edge {
    int from, to;
    long long cost;
};
/// Graph End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

bool _mysort(pair<int, int> a, pair<int, int> b) {
    if (a.second != b.second)
        return a.second < b.second;
    else {
        return a.first < b.first;
    }
}


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(N,M);
    int ans_div  = M/N; 
    int ans = 0;
    for(int i=ans_div;i>=1;i--){
        if(M%i==0){ ans = max(ans,i); break;}
    }
    cout << ans << nn;
    return 0;
}

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

int main() {
  int n,l;
  cin >> n >> l;
  int sum=0;
  rep(i,n){
	sum+=l+i;
  }
  if(l>0) cout <<sum-l <<endl;
  else if(l<=0 && 1<=l+n) cout << sum <<endl;
  else if(l+n<1) cout << sum-l-n+1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
char c;
int total = 700;
int main(void)
{
    for(int i=1;i<=3;i++){
        cin >> c;
        if(c == 'o')total += 100;
    }
    cout << total;
    return 0;
}

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

int main(void){
	int n;
	int flg;
	int len,left,right;
	char s[1004];

	scanf("%d",&n);

	while(n--){
		scanf("%s",s);

		for(flg = 1; strlen(s) != 1; flg = !flg){
			len = strlen(s);
			right = s[len-1] - '0';
			left = s[len-2] - '0';

			s[len-2] = 0;

			sprintf(s, "%s%d", s, left+right);
		}

		printf("%s wins.\n", flg ? "Audrey" : "Fabre");
	}

	return 0;
}

Measured memory_bytes: 424
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    vector<int> log;
    int love_num = 753;
    rep(i, S.size() - 2)
    {
    log.pb(abs(love_num-stoi(S.substr(i,3))));
    }
    sort(log.begin(), log.end());
    cout << log[0] << endl;
 //   system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int h, n;
    cin >> h >> n;
    REP(i,n) h -= in();
    cout << (h <= 0 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n, c; cin >> n >> c;
  V<> v(n), w(n); for (int i = 0; i < n; i++) cin >> v[i] >> w[i];
  V<> dp(accumulate(v.begin(), v.end(), 0) + 1, 1e9);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = dp.size() - 1; j >= v[i]; j--) dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
  }
  for (int j = dp.size() - 1; j >= 0; j--) if (dp[j] <= c) return cout << j << '\n', 0;
}


Measured memory_bytes: 3248
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
int Mergesort(vector<int> &v, int left, int right)
{
    if(right - left <= 1) return 0;
    int res = 0;
    int mid = (left + right) / 2;
    res += Mergesort(v, left, mid);
    res += Mergesort(v, mid, right);

    vector<int> buf;
    for(int i = left; i < mid; i++) buf.push_back(v[i]);
    for(int i = right - 1; i >= mid; i--) buf.push_back(v[i]);

    int pos1 = 0, pos2 = buf.size() - 1;
    for(int i = left; i < right; i++)
    {
        res++;
        if(buf[pos1] <= buf[pos2])
        {
            v[i] = buf[pos1];
            pos1++;
        }
        else
        {
            v[i] = buf[pos2];
            pos2--;
        }
    }
    return res;
} 
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    int ans = Mergesort(v, 0, n);
    for(int i = 0; i < n; i++)
    {
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 8020
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	map<int,int> ct;
	for (int i=0; i<N; i++) {
		int A; cin>>A;
		ct[A]++;
	}
	int ret=0, even=0;
	for (auto it : ct) {
		int cur=it.second%2;
		if(!cur) cur=2, even++;
		ret+=cur;
	}
	if(even%2) even++;
	ret-=even;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <vector>
using namespace std;

string S;
int m;
int c;
int n;



int main() {
	cin >> S;
	m = S.size();
	c = 0;
	
	for (int i = 0; i < m; i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') n++;
		else {
			if (c < n) c = n;
			n = 0;
		}
	}
	if (c < n) c = n;
	n = 0;
	cout << c << endl;

	system("pause");
	return 0;
}



Measured memory_bytes: 504
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

// ここから編集
template<typename T = int> struct BIT{
  vector<T> node;

  int N;
  BIT(int n){
    N = n;
    node.resize(N+1);
  }

  void add(int i, T x){
    i++;
    while(i <= N){
      node[i] += x;
      i += (i & -i);
    }
  }

  T sum(int i){
    T res = 0;
    while(i > 0){
      res += node[i];
      i -= (i & -i);
    }
    return res;
  }

  

};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    
    int a, b, c;
    cin >> a >> b >> c;
    if(!((a==b) && (b == c)) && ((a^b^c) == a || (a^b^c) == b || (a^b^c) == c)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    return 0;
}


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

int main(){
    int n;
    double rec = 0;
    double a[1000];

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

    for(int i = 0; i < n; i++){
        rec += 1 / a[i];
    }
    cout << fixed << 1 / rec << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 510000;
const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    COMinit();
    ll n,k;cin>>n>>k;
    ll r = n-k;
    ll b = k;
    rep(i, k){
        cout << (COM(r+1, i+1)%MOD)*(COM(k-(i+1)+i, i)%MOD)%MOD << endl;
    }
    return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    long long ans = 0;
    long long N, M, K;
    cin >> N >> M >> K;
    vector<int>a(N+1);
    vector<int>b(M+1);
    a[0] = 0;
    b[0] = 0;
    for (int i = 1; i <= N; i++) cin >> a[i];
    for (int i = 1; i <= M; i++) cin >> b[i];
    long long sumA = 0;
    long long sumB = 0;
    long long best = M;
    for (int i = 1; i <= M; i++) sumB += b[i];
    for (long long i = 0; i <= N; i++){
        sumA += a[i];
        for (long long j = best; j >= 0; j--){
            if (sumA + sumB <= K) {
                chmax(ans, i + best);
                break;
            }else{
                if (best > 0){
                    best--;
                }
                sumB -= b[j];
            }
            
        }
        
        
    }
    cout << ans << endl;
}



Measured memory_bytes: 4744
#include <iostream>
using namespace std;
int main(void) {
  char s[3];
  cin >> s;
  if(s[0] == s[1]) {
    if(s[1] != s[2]) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;

int main()
{
    ll A, B, C, K; cin >> A >> B >> C >> K;
    ll ans = 0;
    if (K % 2 == 0) {
        ans = A - B;
    }
    else {
        ans = B - A;
    }

    if (abs(ans) > 1000000000000000000) {
        cout << "Unfair" << endl;
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static  void  main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		for(int i = 0; i < str.length(); i++) {
			char c = str.charAt(i);
			if('a' <= c && c <= 'z') System.out.print((char)(c - 32));
			else if('A' <= c && c <= 'Z') System.out.print((char)(c + 32));
			else System.out.print(c);
		}
		System.out.println();
	}
}



Measured memory_bytes: 26952
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

class UnionFind {
public:
	vector<int> par;//親の番号
    vector<int> rank;//木の深さ
 
	UnionFind(int n){//全ての要素に対して自身が根となるように初期化, 木の深さは0になる
		rep(i,n){
            par.push_back(i);
            rank.push_back(0);
        }
	}
 
	int find(int x) {//木の根を求める
		if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
	}
 
	void unite(int x,int y){//xとyの属する集合を併合
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]){//木の深さが小さい方を大きい方へ繋げる
            par[x]=y;
        }else{
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(int x,int y){//xとyが同じ集合に属するか否か
        return find(x)==find(y);
    }
};
//x以下の要素への最小index, ソートしてから使ってね
template <class T> 
int former(const vector<T> &v, T x){
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> 
int latter(const vector<T> &v, T x){
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
template <class T>
T comb(T n,T k){
    T ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}
//素因数分解
template <class T>
map<T,T> prime_factor(T x){
    map<T,T> ans;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            ans[i]++;
        }
    }
    if (x!=1){
        ans[x]=1;
    }
    return ans;
}
//約数列挙
template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            res.push_back(i);
            if(i!=x/i){
                res.push_back(x/i);
            }
        }
    }
    return res;
}
//素数判定
template <class T>
bool is_prime(T x){
    for(T i=2;i*i<=x;i++){
        if(x%i==0){
            return false;
        }
    }
    return x!=1;
}

const ll inf=1e9+7;

ll mult(ll n,ll m){//n^m%infを求める
    if(m==1){
        return n%inf;
    }else if(m%2==0){//オーバーフロー防止のためにn^(m/2)*n^(m/2)を考える
        ll t=mult(n,m/2);
        return (t*t)%inf;
    }else{//奇数の時はn^(m-1)*nを考える
        ll t=mult(n,m-1);
        return (t*n)%inf;
    }
}

typedef pair<int,int> P;

int n;

int calc(int x){//1以上n以下のうち各桁の和がx以下
    int ret=0;
    FOR(i,1,n+1){
        string num=to_string(i);
        int cnt=0;
        rep(j,len(num)){
            cnt+=int(num[j]-'0');
        }
        if(cnt<=x){
            ret+=i;
        }
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>n>>a>>b;
    int ans=0;
    cout<<calc(b)-calc(a-1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end() 
 

ll mod_pow(ll x,ll n,ll mod) {
ll res=1;
  while(n>0) {
if(n&1) {
res=res*x%mod;
}
   x=x*x%mod;
    n>>=1;
  }
return res;
}


int main() {
  ll mod=1000000007;
 string S;
  cin>>S;
  ll N=S.size();
  vector<ll> vec(N);
  
  ll count=1;
  vec[0]=1;
  for(ll i=1;i<N;i++) {
count*=10;
    count%=13;
    vec[i]=count;
  }
  
  reverse(all(vec));
  

  vector<vector<ll>> dp(N+1,vector<ll> (13,0));
  dp[0][0]=1;
  for(ll i=1;i<=N;i++) {
if(S[i-1]!='?') {
  ll a=vec[i-1]*(S[i-1]-'0');
  a%=13;
  
  for(ll j=0;j<13;j++) {
    if(a+j>12) {
a-=13;
    }
dp[i][a+j]+=dp[i-1][j];
    dp[i][a+j]%=mod;
  }
}
    else {
for(ll j=0;j<10;j++) {
ll a=vec[i-1]*j;
  a%=13;
  for(ll h=0;h<13;h++) {
if(a+h>12) {
a-=13;
}
    dp[i][a+h]+=dp[i-1][h];
    dp[i][a+h]%=mod;
  }
}
    }
    
  }

 
cout<<dp[N][5]<<endl;
}

  
  
  
  
  

Measured memory_bytes: 17480
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int MXN = 2e6+10;
const int MOD = 1e9 + 7;
int fact[MXN];
int add(int x, int y) {return (x+y) % MOD;}
int mul(int x, int y) {return (x*1ll*y) % MOD;}
int bp(int x, int y) {
	int ans = 1;
	while (y) {
		if (y&1) ans = mul(ans, x);
		x = mul(x, x);
		y /= 2;
	}
	return ans;
}
int inv(int x) {return bp(x, MOD-2);}
int comb(int n, int k) {
	return mul(fact[n], inv(mul(fact[k], fact[n-k])));
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int k;
	cin >> k;
	string s;
	cin >> s;
	int n = s.length();
	fact[0] = 1;
	for (int i=1; i<=n+k; i++) fact[i] = mul(fact[i-1], i);
	int ans = bp(26, n+k);
	int sub = 0;
	for (int i=0; i<n; i++) {
		sub = add(sub, mul(comb(n+k, i), bp(25, n+k-i)));
	}
	cout << (ans+MOD - sub)%MOD;
}

Measured memory_bytes: 12148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC006B {
    class Program {
        static void Main(string[] args) {
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = input[0];
            int x = input[1];
            if (x == 1 || x == 2 * N - 1) {
                Console.WriteLine("No");
            } else {
                Console.WriteLine("Yes");
                if (N == 2) {
                    Console.WriteLine(1);
                    Console.WriteLine(2);
                    Console.WriteLine(3);
                } else {
                    int pair = x - 1;
                    int high = x + 2;
                    int low = x + 1;
                    int under = x - 1;
                    if (x == 2 * N - 2) {
                        pair = x + 1;
                        high = x - 1;
                        low = x - 2;
                        under = x - 2;
                    }
                    int mark = 1;
                    for (int i = 0; i < 2 * N - 1; i++) {
                        if (i == N - 2) {
                            Console.WriteLine(low);
                        } else if (i == N - 1) {
                            Console.WriteLine(x);
                        } else if (i == N) {
                            Console.WriteLine(pair);
                        } else if (i == N + 1) {
                            Console.WriteLine(high);
                        } else {
                            if (mark == under) {
                                mark += 4;
                            }
                            Console.WriteLine(mark);
                            mark++;
                        }
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 16592
#ABC063-C
n = int(input())
s = []
for _ in range(n):
    a =int(input())
    s.append(a)
s.sort()
flg = False
gokei = sum(s)
if gokei % 10 != 0:
    print(gokei)
else:
    for i in range(n):
        if gokei % 10 == 0 and s[i] % 10 != 0:
            gokei -= s[i]
            flg = True
            break
    if flg:
        print(gokei)
    else:
        print(0)

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

int main(){
  int N, M;
  cin >> N >> M;
  int ans = 1;
  for(int i = 1; i*i < M; i++){
    if(M % i == 0){
      int a = M/i;
      if(i >= N) ans = max(ans, a);
      if(a >= N) ans = max(ans, i);
    }
  }
  cout << ans << endl;
  return 0;
}


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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int a, b, c, d, p; cin >> a >> b >> c >> d >> p;
	cout << min(a*p, max(p - c, 0)*d + b) << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;

  int cnt = 0;
  while (b <= a) {
    b *= 2;
    ++cnt;
  }
  while (c <= b) {
    c *= 2;
    ++cnt;
  }

  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    String C = scanner.next();
	    String[] alphabets = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
	    
	    for (int i = 0; i < alphabets.length; i++) {
	    	if (C.equals(alphabets[i])) {
	    		C = alphabets[i + 1];
	    		break;
	    	}    	   
	    }
	    System.out.println(C);
	    
	}
	
}	

Measured memory_bytes: 20820
#include<iostream>
#include<cstdio>
using namespace std;
int b[200][200];
int n,m;
char a[200][200];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void dfs(int x,int y)
{
	int nx,ny;
	for(int i=0;i<4;i++)
	{
		nx=x+dx[i];
		ny=y+dy[i];
		if(nx>=1&&ny>=1&&nx<=n&&ny<=m&&!b[nx][ny]&&a[nx][ny]==a[x][y])
		{
			b[nx][ny]=true;
			dfs(nx,ny);
		}
	}
}
int main()
{   int i,j;
	int ans;
	while(scanf("%d%d",&n,&m))
	{	
		ans=0;
		if(n==0)
			break;
		for(i=1;i<=n;i++)
			for(j=1;j<=m;j++)
			{
				cin>>a[i][j]; 
				b[i][j]=0;
			}
		for(i=1;i<=n;i++)
			for(j=1;j<=m;j++)
			{
				if(!b[i][j])
				{
					b[i][j]=true;
					ans++;
					dfs(i,j);
				}				
			}
	printf("%d\n",ans);	
	}	
} 


Measured memory_bytes: 3764
#include <stdio.h>

int main(){
	int a, b, ans = 0;
	char op;

	while (1){//loop
		scanf("%d %c %d", &a, &op, &b);//入力

		if (op == '+'){
			ans = a + b;
		}else if (op == '-'){
			ans = a - b;
		}else if(op == '*'){
			ans = a * b;
		}else if (op == '/'){
			ans = a / b;
		}else if (op == '?'){
			break;
		}

		printf("%d\n", ans);

	}
	return 0;
}

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

typedef long long int ll;

ll M = 1000000007;

/* Iterative Function to calculate (x^y)%p in O(log y) */
ll power(ll x,ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
	ll i,j,k,l,m,n,t;

	ll u,v;

	cin >> n;

	if(n == 1)
	{
		cout << 0 << '\n';
		return 0;
	}

	k = power(10,n,M);
	k = k%M;
	l = power(9,n,M)*2;
	l = l%M;
	m = power(8,n,M);
	m = m%M;

	
	// cout << l << '\n';
	// cout << k << '\n';
	// cout << m << '\n';

	cout << (k+m-l+M)%M << '\n';

}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	N, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	if N%2 == 0 {
		fmt.Println(N / 2)
	} else {
		fmt.Println((N / 2) + 1)
	}
}


Measured memory_bytes: 1832
a, b, c, x, y = map(int, input().split())

ans1 = a * x + b * y
ans2 = min(x, y) * 2 * c + [a, b][max(x, y) == y] * abs(x - y)
ans3 = max(x, y) * 2 * c

print(min(ans1, ans2, ans3))

Measured memory_bytes: 61932
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String str = null;
		String[] split = new String[2];
		int[] x = new int[3000];
		int[] y = new int[3000];
		int i = 0;


		while(true){
			// 読み込み
			str = scan.nextLine();
			split = str.split(" ");
			x[i] = Integer.parseInt(split[0]);
			y[i] = Integer.parseInt(split[1]);

			// break条件
			if(x[i] == 0 && y[i] == 0) break;

			// 入れ替え処理+格納処理
			if(x[i] > y[i]){
				swap(x, y, i);
			}
			i++;
		}
		for(int j=0; j<i; j++){
			System.out.println(x[j] + " " + y[j]);
		}
	}
	static void swap(int[] x, int[] y, int i){
		int tmp = 0;

		tmp = x[i];
		x[i] = y[i];
		y[i] = tmp;
	}
}


Measured memory_bytes: 35276
// Vote
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
	int N, M, i, j, maxp = 0, maxs;
	scanf("%d %d", &N, &M);
	int a[N], b[M], p[N];
	for (i = 0; i < N; ++i){
		cin >> a[i];
		p[i] = 0;
	}
	for (j = 0; j < M; ++j){
		cin >> b[j];
	}
	for (j = 0; j < M; ++j){
		for (i = 0; i < N; ++i){
			if (a[i] <= b[j]){
				p[i]++;
				break;
			}
		}
	}
	for (i = 0; i < N; ++i){
		if (p[i] > maxp){
			maxp = p[i];
			maxs = i+1;
		}
	}
	cout << maxs << endl;
	return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

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

    if((s[0] == s[2] || s[0] == s[1] || s[1] == s[2]) && !(s[0] == s[1] && s[1] == s[2]))
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        int[] abc = Console.ReadLine().ToIntArray();
        int A = abc[0];
        int B = abc[1];
        int C = abc[2];
        int K = Console.ReadLine().ToInt();

        var arr = new[] { A, B, C };
        Array.Sort(arr);

        Console.WriteLine(arr[0] + arr[1] + arr[2] * (int)Math.Pow(2, K));
    }
}

Measured memory_bytes: 13268
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):

    # hが正である組を選ぶ
    for i in range(N):
        if h[i] > 0:
            break

    # 領域を全探索する。各位置が頂点になる場合の高さをh[i]から求める
    cand = [[0]*101 for _ in range(101)]
    for j in range(101):
        for k in range(101):
            cand[j][k] = h[i]+abs(x[i]-k)+abs(y[i]-j)

    # 各頂点の高さが適切か。適切なら出力。
    for i in range(101):
        for j in range(101):
            flags = [max(cand[i][j]-abs(x[k]-j)-abs(y[k]-i), 0) == h[k]
                     for k in range(N)]
            if all(flags):
                print(j, i, cand[i][j])
                return

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    h = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include<stdio.h>
int main(void){
    int A1,A2,A3;
    scanf("%d %d %d",&A1,&A2,&A3);
    int x=A1+A2+A3;
    if(22<=x){
        printf("bust\n");
    }else if(x<22){
        printf("win\n");
    }
}

Measured memory_bytes: 128
n=int(input())
l=list(map(int,input().split()))
an=0;md=10**9+7
suf=[0]*n
suf[-1]=l[-1]
for i in range(n-2,-1,-1):
  suf[i]=suf[i+1]+l[i]
for i in range(n-1):
  an=(an+l[i]*suf[i+1])%md
print(an)

Measured memory_bytes: 31672
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong(), b = in.nextLong();
		in.close();
		long targ = getGCD(a, b);

		// System.out.println("targ:" + targ);
//		if ( targ == 1 ) {
//			System.out.println(1);
//			return;
//		}

		// 素因数分解
		long cnt = 0;
		if ( targ != 0 && targ % 2 == 0 ) {
			targ /= 2;
			cnt++;
			while ( targ % 2 == 0 ) {
				targ /= 2;
			}
		}

		Long div = 3L;
		while ( div <= Math.sqrt(targ) ) {
			if ( targ % div == 0 ) {
				// System.out.println("div:" + div);
				cnt++;
			}
			while ( targ % div == 0 ) {
				targ /= div;
			}
			div += 2;
		}

		if ( targ != 1 ) cnt++;
		System.out.println(cnt + 1);
	}

	private static long getGCD(long a, long b) {
		if ( b == 0 ) return a;
		else return getGCD(b, a % b);
	}
}

Measured memory_bytes: 27348
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

const int MOD = 1e9+7;

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}


int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N),less(N,0),kleene(N,0);
    rep(i,N)cin >> A[i];
    rep(i,N){
        int a = A[i];
        for(int j=0;j<N;j++){
            if(A[j]<a)less[i]++;
            if(j>i&&A[j]<a)kleene[i]++;
        }
    }

    ll res = 0;
    if(K>1){
        rep(i,N){
        ll a = (K*kleene[i])%MOD;
        ll b = (((K*K)%MOD)*less[i])%MOD;
        ll c = (less[i]*(((K*(K+1))/2)%MOD))%MOD;
        res += mod((a+b-c),MOD);
        res%=MOD;
        }
    }else{
        rep(i,N){
            res += kleene[i];
            res%=MOD;
        }
    }
    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
const int maxn = 1e3 + 5;
const int inf = 1e9 + 7;
char G[maxn][maxn];
bool vis[maxn][maxn];
long long dp[maxn][maxn];
long long step ;
int n , m;
long long dfs(int x , int y){
	if(vis[x][y])return dp[x][y];
	if(x == n && y == m - 1)return 1;
	vis[x][y] = 1;
	if(G[x + 1][y] == '.') dp[x][y] += dfs(x + 1 , y);
	if(G[x][y + 1] == '.') dp[x][y] += dfs(x , y + 1);
	return dp[x][y] %inf;
}
int main(){
	int ans;
	scanf("%d%d ",&n,&m);
	for(int i = 1;i <= n;i++){
		scanf("%s",G[i]);
	}
	ans = dfs(1 , 0) %inf;
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 10112
import sys
input = sys.stdin.readline

DIV = 10**9+7
s = input()
n = len(s)-1
ary = [ (int(s[i]) if s[i] != '?' else -1) for i in range(n) ]
dp = [ [0 for _ in range(13)] for _ in range(n+1) ]
dp[0][0] = 1
for i in range(n):
    for j in range(10):
        if ary[i] != -1 and ary[i] != j:
            continue
        for k in range(13):
            dp[i+1][(k*10+j)%13] += dp[i][k]

    for j in range(13):
        dp[i+1][j] %= DIV
print(dp[n][5])

Measured memory_bytes: 67760
import numpy as np
num_list = []

def leg_num(c, t):
    return 2*c+4*t

for i in range(1, 101):
    leg_num_list = []
    for j in range(i):
        if leg_num(j, i-j) <= 100:
            leg_num_list.append(leg_num(j, i-j))
        if leg_num(i-j, j) <= 100:
            leg_num_list.append(leg_num(i-j, j))
    num_list.append(leg_num_list)

x, y = map(int, input().split(" "))
if y in num_list[x-1]:
    print("Yes")
else:
    print("No")

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

MOD=10**9+7
def gcd(a,b):
    while b: a,b=b,a%b
    return a
def lcm(a,b): return a*b//gcd(a,b)

LCM=A[:]
num=N
while num>1:
    for i in range(1,num,2):
        LCM[i//2]=lcm(LCM[i-1],LCM[i])
    if num&1:
        LCM[num//2]=LCM[num-1]
    num=(num+1)//2

ans=0
l=LCM[0]%MOD
for a in A:
    ans+=l*pow(a,MOD-2,MOD)
    ans%=MOD

print(ans)

Measured memory_bytes: 45148
program main;
var
	s : string;
    len : integer;

begin
	read(s);
    len := length(s);
    
    if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')
        	then writeln('hon');
        if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')
        	then writeln('pon');
        if s[len]='3'
        	then writeln('bon');
end.

Measured memory_bytes: 1380
#include <stdio.h>

#define MAX (10000)

char prime[MAX + 1];

int main(void)
{
	int i, j, n;
	
	prime[0] = prime[1] = 0;
	for (i = 2; i <= MAX; i++){
		prime[i] = 1;
	}
	
	for (i = 2; i * i <= MAX; i++){
		for (j = i * i; j <= MAX; j += i){
			prime[j] = 0;
		}
	}
	
	while (scanf("%d", &n), n != 0){
		i = n;
		while (prime[i] != 1 || prime[i - 2] != 1){
			i--;
		}
		printf("%d %d\n", i - 2, i);
	}
	
	return (0);
}

Measured memory_bytes: 608
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a, b, c;
    cin >> a >> b >> c;
    double h = b * sin(M_PI * c / 180);
    double a_ = b * cos(M_PI * c / 180);
    double s = a * h / 2;
    double l = a + b + sqrt(h*h + (a-a_)*(a-a_));
    cout << fixed << setprecision(8) << s << " " << l << " " << h << "\n";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    rep(i, k){
        if(a >= b) b*=2;
        else c*=2;
    }
    if(a < b && b < c) Yes();
    else No();
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int a[100007],mark[100007];
int main()
{
	int n,i,j,k,x,y,z,c;
	cin>>n;
	for(i=1;i<=n;++i)
	{
	    cin>>a[i];
    }
	x=1;
	c=0;
    mark[1]=1;
    while(x!=2)
    {
    	c++;
    	x=a[x];
    	if(mark[x])break;
    	mark[x]=1;
	}
	if(x==2)
	cout<<c<<endl;
	else cout<<"-1"<<endl;
	return 0;
}


Measured memory_bytes: 1024
N,C,K = gets.split.map &:to_i
T = N.times.map{gets.to_i}.sort

res = 0
l = 0
r = 1
loop do
  r += 1 while (r < T.size) && (T[r] <= T[l]+K)
  if r == T.size
    res += (r-l+C-1)/C
    break
  end
  res += 1
  l += C
  l = r unless l <= r
end
p res


Measured memory_bytes: 4656
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define scan(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define print(n) printf("%d",n)
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define all(v)        v.begin(),v.end()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          1e12+5
#define ninf         -1e17
#define fast()         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const   ll mod=1e9+7;
const ll N=1e5+5;



int main() 
{ 
          fast();
         

          int n;
          cin >> n;
          std::vector<ll> a(n);
          rep(i,0,n)
          cin >> a[i];
          std::vector<ll> sum(n);
          sum[n-1]=a[n-1];
          for(int i=n-2;i>=0;i--)
          sum[i]=(sum[i+1]+a[i])%mod;
        ll ans=0;
        // rep(i,0,n)
        // cout<<sum[i]<<" ";
        // cout<<endl;
        rep(i,0,n-1)
        {
          ans=(ans+sum[i+1]*a[i])%mod;
        }
        cout<<ans;

          
           return 0; 

} 

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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int ans = 0, cur = 0;
    for(int i = 0; i < 3; i++) {
        char c;
        cin >> c;
        if(c == 'R') {
            cur++;
        }
        else {
            cur = 0;
        }
        if(cur > ans) {
            ans = cur;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<string.h>
int main(void)
{
	int n,out,score,lanner,total_out=0;
	char judge[10];

	scanf("%d",&n);

	while (n * 3 > total_out) {
		lanner = 0;
		score = 0;
		out = 0;
		while (out < 3) {
			scanf("%s",judge);
			if (strcmp(judge, "HIT") == 0) {
				lanner++;
				if (lanner == 4) {
					score++;
					lanner-=1;
				}
			}
			else if (strcmp(judge, "OUT") == 0)
				out++;
			else if (strcmp(judge, "HOMERUN") == 0) {
				score += lanner + 1;
				lanner = 0;
			}
		}
		printf("%d\n",score);
		total_out += out;
	}
	return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	if (n / 2 + (n&1==1) >= k) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256