akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	string s; cin >> s;
	vector<vector<int>> pos(10, vector<int>());
	rep(i, 0, n - 1)
	{
		pos[s[i] - '0'].push_back(i);
	}
	int cnt = 0;
	rep(i, 0, 9)
	{
		if (pos[i].size() == 0)continue;
		
		rep(j, 0, 9)
		{
			int now = pos[i][0] + 1;
			if (pos[j].size() == 0)continue;
			
			auto it = lower_bound(all(pos[j]), now);
			if (it == pos[j].end())continue;

			now = *it + 1;
			rep(k, 0, 9)
			{
				if (pos[k].size() == 0)continue;
				it = lower_bound(all(pos[k]), now);
				if (it == pos[k].end())continue;

				++cnt;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int K =sc.nextInt();
      int X =sc.nextInt();
      
      if(500*K>=X){
      System.out.println("Yes");
      }
      else{
      System.out.println("No");
      }
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N; cin >> N;
  ll dp[62][3] = {}; dp[61][0] = 1;
  per(i,61) {
    if (N&(1ll<<i)) {
      dp[i][0] = (dp[i][0]+dp[i+1][0]) % MOD;
      dp[i][1] = (dp[i][1]+dp[i+1][0]+dp[i+1][1]) % MOD;
      dp[i][2] = (dp[i][2]+dp[i+1][1]*2+dp[i+1][2]*3) % MOD;
    }
    else {
      dp[i][0] = (dp[i][0]+dp[i+1][0]+dp[i+1][1]) % MOD;
      dp[i][1] = (dp[i][1]+dp[i+1][1]) % MOD;
      dp[i][2] = (dp[i][2]+dp[i+1][1]+dp[i+1][2]*3) % MOD;
    }
  }

  // per(i,62) debug(dp[i],dp[i]+3);
  ll result = (dp[0][0] + dp[0][1] + dp[0][2] ) % MOD;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3640
import java.io.IOException;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		while (true) {
			int N = nextInt();// ステージの数
			if (N == 0) {
				break;
			}
			int[][] stages = new int[N][N + 1];// ステージ攻略にかかる時間
			for (int i = 0; i < stages.length; i++) {
				for (int j = 0; j < stages[i].length; j++) {
					stages[i][j] = nextInt();
				}
			}

			int[] dp = new int[1 << N];// 全パターン数は2のN乗通り。
			Arrays.fill(dp, Integer.MAX_VALUE);
			dp[0] = 0;

			for (int bit = 0; bit < dp.length; bit++) {
				for (int j = 0; j < N; j++) {
					if (((bit >> j) & 1) == 0) {
						// jステージをクリアしていない時、jステージ攻略の最速タイムを考える。
						int min = stages[j][0];// とりあえずまずは装備無しを考えておく。
						for (int k = 0; k < N; k++) {
							if (((bit >> k) & 1) == 1) {
								// kステージをクリアしてる時のjステージ攻略タイムと比べて短い方をもっておく
								min = Math.min(min, stages[j][k + 1]);
							}
						}
						dp[bit + (1 << j)] = Math.min(dp[bit + (1 << j)],
								dp[bit] + min);
					}
				}
			}
			System.out.println(dp[dp.length - 1]);
		}

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}

	static char nextChar() {
		try {
			int b = System.in.read();
			while (b != -1 && (b == ' ' || b == '\r' || b == '\n'))
				;
			if (b == -1)
				return 0;
			return (char) b;
		} catch (IOException e) {
		}
		return 0;
	}

}

Measured memory_bytes: 28376
#include <stdio.h>
                                                                                                         
int main(){                                                                                              
    int n;                                                                                               
    scanf("%d", &n);                                                                                     
    long long int h[n];                                                                                  
    for(int i = 0; i < n; i++){                                                                          
        scanf("%lld", &h[i]);                                                                            
    }                                                                                                    
    int ans = 0;                                                                                         
    int cnt = 0;                                                                                         
    for(int i = 0; i < n - 1; i++){                                                                      
        cnt = 0;                                                                                         
        for(int l = i; h[l] >= h[l + 1]; l++){                                                           
            cnt++;                                                                                       
            if(ans <= cnt){                                                                              
                ans = cnt;                                                                               
            }                                                                                            
            i++;                                                                                         
        }                                                                                                
    }                                                                                                    
    printf("%d\n", ans);                                                                                 
    return 0;                                                                                            
}   

Measured memory_bytes: 896
fun main(args: Array<String>?): Unit {
    val n = readLine()!!.trim().toInt()
    val memo = Array(101){Array(101){ Suspect.Less(Int.MAX_VALUE) as Suspect }}
    repeat(n){
        val (x, y, h) = readLine()!!.trim().split(' ').map(String::toInt)
        for (cx in 0 .. 100) for (cy in 0 .. 100) if (memo[cx][cy] != Suspect.Nothing) {
            val suspect = memo[cx][cy]
            val distance = Math.abs(x - cx) + Math.abs(y - cy)
            if (h == 0) {
                when(suspect) {
                    is Suspect.Less -> {
                        if (suspect.height > distance) {
                            memo[cx][cy] = Suspect.Less(distance)
                        }
                    }
                    is Suspect.Just -> {
                        if (suspect.height > distance) {
                            memo[cx][cy] = Suspect.Nothing
                        }
                    }
                    else -> {}
                }
            }else {
                when(suspect) {
                    is Suspect.Less -> {
                        if (suspect.height >= distance + h) {
                            memo[cx][cy] = Suspect.Just(distance + h)
                        }else {
                            memo[cx][cy] = Suspect.Nothing
                        }
                    }
                    is Suspect.Just -> {
                        if (suspect.height != distance + h){
                            memo[cx][cy] = Suspect.Nothing
                        }
                    }
                    else -> {}
                }
            }
        }
    }
    for (cx in 0 .. 100) for (cy in 0 .. 100) if (memo[cx][cy] is Suspect.Just) {
        println("$cx $cy ${(memo[cx][cy] as Suspect.Just).height}")
        return
    }
    for (cx in 0 .. 100) for (cy in 0 .. 100) if (memo[cx][cy] is Suspect.Less) {
        println("$cx $cy ${(memo[cx][cy] as Suspect.Less).height}")
        return
    }
    TODO()
}
sealed class Suspect {
    object Nothing : Suspect()
    class Less(val height: Int) : Suspect()
    class Just(val height: Int): Suspect()
}

Measured memory_bytes: 40060
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
    const int L = (1 << 20) + 1;

    char buf[L], *S , *T, c;

    char getchar() {
        if(__builtin_expect(S == T, 0)) {
            T = (S = buf) + fread(buf, 1, L, stdin);
            return (S == T ? EOF : *S++);
        }
        return *S++;
    }

    int inp() {
        int x = 0, f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }

    unsigned inpu()
    {
        unsigned x = 0; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar());
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x;
    }

    ll inp_ll() {
        ll x = 0; int f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }

    char B[25], *outs=B+20, *outr=B+20;
    template<class T>
    inline void print(register T a,register char x=0){
        if(x) *--outs = x, x = 0;

        if(!a)*--outs = '0';
        else
            while(a)
                *--outs = (a % 10) + 48, a /= 10;

        if(x)
            *--outs = x;

        fwrite(outs, outr - outs , 1, stdout);
        outs = outr;
    }
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
    if (!b) return 1;
    ll t = power(a, b/2, p);
    t = t*t%p;
    if (b&1) t = t*a%p;
    return t;
}

ll gcd(ll a, ll b)
{
    return b ? gcd(b, a%b) : a;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
    if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
    if (a < b) a = b;
}

const int maxN = 100005;
const int DEG = 4;
const int BASE = 10;
const int MAXP = 10000000;
const int MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const ll INF = 10000000000000000LL;
const ll inf = 5000000000000LL;

ll a[maxN];
int main()
{
    int n = inp();
 //   int m = inp();

    for (int i = 1; i <= n; ++ i)
    {
    	a[i] = inp_ll();
	}
	ll d = a[1];
	for (int i = 2; i <= n; ++ i)
    {
    	d = gcd(d,a[i]);
	}
	cout<<d<<endl;
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a != 0 ? gcd (b % a, a) : b; }

int n;
int m;

int x[200000];
ll s[200001];

ll calc (int i, int j, int t) {
	if (i == j) re 0;
	ll ans = 0;
	if (t == 1) {
		int k = (i + j) / 2;
		if ((j - i) % 2 == 0) {
			ans = 2 * (s[i] - s[k]) - x[k - 1] - 2 * (s[k + 1] - s[j + 1]) + x[j];
			ans += (ll)m * (j - i - 1);
			ans += max ((x[k - 1] - x[k]), m - (x[k - 1] - x[k]));
		} else {
			ans = 2 * (s[i] - s[k]) - (s[k + 1] - s[j]) - (s[k + 2] - s[j + 1]);
			ans += (ll)m * (j - i - 1);
			ans += max ((x[k + 1] - x[k]), m - (x[k + 1] - x[k]));
		}
	} else {
		int k = (i + j) / 2;
		if ((j - i) % 2 == 0) {
			ans = 2 * (s[i] - s[k]) - x[i] - 2 * (s[k + 1] - s[j + 1]) + x[k + 1];
//			cout << 2 * (s[i] - s[k]) - x[i] << " " << -2 * (s[k + 1] - s[j + 1]) + x[k + 1] << " " << ans << endl;
			ans += (ll)m * (j - i - 1);
//			cout << ans << endl;
			ans += max ((x[k + 1] - x[k]), m - (x[k + 1] - x[k]));
//			cout << ans << endl;
		} else {
			ans = s[i] - s[k] + s[i + 1] - s[k + 1] - 2 * (s[k + 2] - s[j + 1]);
			ans += (ll)m * (j - i - 1);
			ans += max ((x[k + 1] - x[k]), m - (x[k + 1] - x[k]));
		}
	}
	re ans;
}

int main () {
	scanf ("%d%d", &m, &n);
	for (int i = 0; i < n; i++) scanf ("%d", &x[i]);
	s[n] = 0;
	sort (x, x + n);
	ll ans = 0;
	for (int t = 0; t < 2; t++) {	
		s[n] = 0;
		for (int i = n - 1; i >= 0; i--) s[i] = s[i + 1] + x[i];
		for (int i = 0; i < n; i++) {
			ans = max (ans, x[i] + calc (i, n - 1, 0));
//			cout << x[i] << " " << calc (i, n - 1, 0) << endl;
			if (i > 0 && i <= n - 2) {
//				cout << x[0] << " " << m - (x[n - 1] - x[0]) << " " << m - (x[n - 1] - x[i]) << " " << calc (i, n - 2, 0) << endl;
				ans = max (ans, x[0] + m - (x[n - 1] - x[0]) + m - (x[n - 1] - x[i]) + calc (i, n - 2, 0));
			}	
		}
		reverse (x, x + n);
		for (int i = 0; i < n; i++) x[i] = m - x[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

#define ANUM(x) (sizeof(x) / sizeof((x)[0]))

typedef enum {
    FALSE = 0,
    TRUE = 1
} BOOL;

int main(void) {
    int w, h, x, y, r;
    
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    
    if (x - r < 0) {
        printf("No\n");
    } else if (x + r > w) {
        printf("No\n");
    } else if (y - r < 0) {
        printf("No\n");
    } else if (y + r > h) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }

    return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n,m,k;
    cin>>n>>m>>k;
    if(n>m)
    {
        int z=(k/n);
        if(k%n)
            z++;
        cout<<z;
    }
    else
    {
        int z=(k/m);
        if(k%m)
            z++;
        cout<<z;
    }


} 



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long int
int main()
{
    ll x,y;
    cin>>x>>y;
    if(x>0 && x<10 &&y>0 && y<10)
        cout<<x*y<<endl;
    else cout<<"-1"<<endl;
}


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

int main() {
    long long n;
    cin >> n;
    string s;
    long long d[5];
    for(int i=0;i<5;i++) d[i]=0;
    int p[10]={0,0,0,0,0,0,1,1,1,2};
    int q[10]={1,1,1,2,2,3,2,2,3,3};
    int r[10]={2,3,4,3,4,4,3,4,4,4};
    for(int i=0;i<n;i++){
        cin >> s;
        if(s[0]=='M') d[0]++;
        if(s[0]=='A') d[1]++;
        if(s[0]=='R') d[2]++;
        if(s[0]=='C') d[3]++;
        if(s[0]=='H') d[4]++;
    }
    long long ans=0;
    for(int i=0;i<10;i++){
        ans+=d[p[i]]*d[q[i]]*d[r[i]];
    }
    cout << ans << endl;
}

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


int main(){
  int i,j,k,r,c,sum;
  int **hyou;
  scanf("%d%d",&r,&c);
  hyou=malloc(r*sizeof(int *));
  for(i=0;i<r;i++){
    hyou[i]=malloc(c*sizeof(int));}
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&hyou[i][j]);}
    }
  for(i=0;i<r;i++){
    for(j=0;j<=c;j++){
      if(j==c){
        sum=0;
        for(k=0;k<c;k++){
          sum=sum+hyou[i][k];}
        printf("%d\n",sum);}
      else{
        printf("%d ",hyou[i][j]);}
      }
    }
  for(i=0;i<c;i++){
    sum=0;
    for(j=0;j<r;j++){
      sum=sum+hyou[j][i];}
    printf("%d ",sum);}
  sum=0;
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      sum=sum+hyou[i][j];}}
  printf("%d\n",sum);
  for(i=0;i<r;i++){
    free(hyou[i]);}
  free(hyou);
  return 0;}

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

// マクロ
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

int main() {

	int N;
	string s;

	cin >> N;
	cin >> s;

	int count = 0;
	rep(i, N - 2) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
			count++;
		}
	}
	cou(count);
}

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

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(x) cout << #x << ":\t" << x << endl
#define _ << " " <<

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll N = 3e3 + 3;

ll n, a[N];
ll mx[N][N], mn[N][N];

void show() {
	for (ll i = 1; i <= n; ++i) {
		for (ll j = 1; j <= n; ++j) cout << mx[i][j] << " ";
		cout << endl;
	}
	cout << endl;
	for (ll i = 1; i <= n; ++i) {
		for (ll j = 1; j <= n; ++j) cout << mx[i][j] << " ";
		cout << endl;
	}
}

int main() {
//	mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
//	freopen("in", "r", stdin)
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n;
	for (ll i = 1; i <= n; ++i) cin >> a[i];
	
	for (ll i = 1; i <= n; ++i) {
		mx[1][i] = a[i];
		mx[2][i] = max(a[i], a[i-1]);
		mn[2][i] = min(a[i], a[i-1]);
	}
	mx[2][1] = mn[2][1] = 0;
	
	for (ll i = 3; i <= n; ++i) {
		for (ll j = i; j <= n; ++j) {
			ll x1 = a[j] + mn[i-1][j-1], y1 = mx[i-1][j-1];
			ll x2 = a[j - i + 1] + mn[i-1][j], y2 = mx[i-1][j];
			if (x1 < x2) {
				swap(x1, x2);
				swap(y1, y2);
			}
			mx[i][j] = x1;
			mn[i][j] = y1;
		}
	}
	cout << mx[n][n] - mn[n][n] << "\n";
	
	return 0;
}


Measured memory_bytes: 139776
#include<stdio.h>
#include<string.h>
#include<stdlib.h>



int main(){
  int N;
  int i,j;
  int *A;
  int key;
  scanf("%d",&N);//読み込み完了
  
  A=malloc(N*sizeof(int));
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  
  for(i=0;i<N;i++){
    key=A[i];
    for(j=i-1;j>=0;j--){
      if( key >= A[j]) break;
      A[j+1]=A[j];
    }
    A[j+1]=key;
    for(j=0;j<N-1;j++) printf("%d ",A[j]);
    printf("%d\n",A[N-1]);
  }
  return 0;
}


Measured memory_bytes: 2080
#include <stdio.h>

const int M = 25;
const int prime[25] = {  2,  3,  5,  7, 11, 13, 17, 19, 23, 
                        29, 31, 37, 41, 43, 47, 53, 59, 61,
                        67, 71, 73, 79, 83, 89, 93
                      }; 
int fact[25];

int comb(int a) {
    return a*(a-1)/2;
}

int main(void) {
    int i, N, d, res, two, four, fourteen, twentyfour, seventyfour, X;
    scanf("%d", &N);

    for (i=0;i<M;i++) {
        d = prime[i];
        do {
            res = N/d;
            fact[i] += res;
            d *= prime[i];
        } while (res > 0);
    }

    // i^74, i^24 j^2, i^14 j^4, i^4 j^4 k^2
    two = 0;
    four = 0;
    fourteen = 0;
    twentyfour = 0;
    seventyfour = 0;
    X = 0;
    for (i=0;i<M;i++) {
        if (fact[i] >= 74) seventyfour++;
        if (fact[i] >= 24) twentyfour++;
        if (fact[i] >= 14) fourteen++;
        if (fact[i] >= 4) four++;
        if (fact[i] >= 2) two++;
    }

    X += seventyfour;
    if (two >= 2) X += twentyfour*(two-1);
    if (four >= 2) X += fourteen*(four-1);
    if (two >= 3) X += four*(four-1)*(two-2)/2;

    // for (i=0;i<M;i++) printf("%2d,", fact[i]);
    // printf("\t");
    printf("%3d\n", X);

    return 0;
}

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

int main(){
  string str;
  cin >> str;
  int n = str.size();
  int m = n;
  int u[100000];
  for (int i = 0; i < n; i++){
    u[i] = str[i] - '0';
    if (i != 0) {
      if (u[i-1] != u[i]){
        m = min(m, max(i, n-i));
      }
    }
  }
  printf("%d\n", m);
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
vector<int> dp(n),height(n);
for(int i=0;i<n;i++)
cin>>height[i];
dp[0]=0;
for(int i=1;i<n;i++)
{
dp[i] = INT_MAX;
for( int back = 1;back<=min(k,i);back++)
{
	dp[i] = min(dp[i],dp[i-back]+abs(height[i]-height[i-back]));
}

}
cout<<dp[n-1];
return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int64_t abs(int64_t n) {
  if (n < 0) {
    n = -n;
  }
  return n;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

int main() {
  int n;
  cin >> n;
  vector <int> v(n-1);
  rep(i, n-1) cin >> v.at(i);
  int64_t ans = 0;
  rep(i, n) {
    if (i == 0) {
      ans += v.at(0);
    } else if (i == n-1) {
      ans += v.at(n-2);
    } else {
      ans += min(v.at(i-1), v.at(i));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
ll dp[MAX_N];

int main(){
    ll n;
    cin>>n;
    vector<ll> h(n);
    for(ll i=0;i<n;i++){
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++){
        ll maemae=abs(h[i]-h[i-2])+dp[i-2];
        ll mae=abs(h[i]-h[i-1])+dp[i-1];
        dp[i]=min(maemae,mae);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>



#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define sz(a) ((int)a.size())
#define getmid ((l+r)>>1)
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define lowbit(x) x&(-x)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
using namespace std;
#ifdef local
#define dbg(args...) cout << #args << " -> ", err(args);
void err(){ cout << endl; }
template<typename T, typename... Args>
void err(T a, Args... args){ cout << a << ' '; err(args...); }
#else
#define dbg(args...)
#endif // local

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-8;
const int mod=1e9+7;
const int maxn=1e6+100;
const int N=1e5+10;
const int M=1e6+10;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x)
{
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar())
        f ^= c == '-';
    for (; isdigit(c); c = getchar())
        x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10)
        ++len;
    for (; len; --len, x %= y, y /= 10)
        putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

char mp[10][10];
char s[10][10];
int n,m,k;
int solve(int x,int y)
{
    rep(i,n) rep(j,m) s[i][j]=mp[i][j];
    for(int j=0;j<n;++j)
    {
        if(x>>j&1)
        {
            for(int i=0;i<m;++i) s[j][i]='.';
        }
    }
    for(int j=0;j<m;++j)
    {
        if(y>>j&1)
        {
            for(int i=0;i<n;++i) s[i][j]='.';
        }
    }
    int cnt=0;
    rep(i,n) rep(j,m) if(s[i][j]=='#') cnt++;
    return cnt==k;
}
int main()
{
#ifdef local
      freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // local
    IOS;cout.tie(0);
    cin>>n>>m>>k;
    rep(i,n) cin>>mp[i];
    int ans=0;
    for(int i=0;i<(1<<n);++i)
    {
        for(int j=0;j<(1<<m);++j)
        {
            if(solve(i,j)) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int ans = 0;

    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == '+') {
        ans++;
      } else {
        ans--;
      }
    }

    System.out.println(ans);

  }
}

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

int main(){
    string S;
    cin >> S;
    string X = S.substr(0,S.size()/2);
    string Y = S.substr(S.size()/2+1);
    for(int i = 0; i < S.size(); i++) {
        if(S[i] != S[S.size()-1-i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0; i < S.size()/2; i++) {
        if(X[i] != X[S.size()/2-1-i]) {
            cout << "No" << endl;
            return 0;
        }
        else if(Y[i] != Y[S.size()/2-1-i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main(int argc, char const *argv[])
{
	int n, d; cin >> n >> d;
	vector<vector<int>> x(n, vector<int>(d));
	rep(i, n) rep(j, d) cin >> x[i][j];

	int ans = 0;
	rep(i, n) rep(j, n) {
		if (i >= j) continue;
		int sum = 0;
		rep(k, d) sum += pow(abs(x[i][k] - x[j][k]), 2);
		bool check = false;
		// cout << "sum:" << sum << endl;
		rep(k, 10000) if (sum == k * k) check = true;
		if (check) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [n for _ in range(H) for n in list(map(int, input().split()))]

o = [c[n][1] for n in range(10)]

for _ in range(10):
    for i in range(10):
        for t in range(10):
            o[i] = min(o[i], c[i][t] + o[t])

print(sum([o[a] for a in A if a >= 0]))


Measured memory_bytes: 3872
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int sum = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '1') {
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
N_n_osatsu, Y_sum_money = map(int, input().split())

rest_money = Y_sum_money
rest_n_osatsu = N_n_osatsu
n_each_osatsu_list = [] # 万札、五千円札、千円札の枚数の2重リスト

def skip_search(rest_money, rest_n_osatsu):  # 明らかに無理な場合、処理をスキップ
    if rest_n_osatsu*1000 > rest_money or rest_n_osatsu*10000 < rest_money:
        return True

def is_answer(n_10000, n_5000, n_1000): # 正答ならばそれを出力して終了
    if n_10000 + n_5000 + n_1000 == N_n_osatsu and n_10000*10000 + n_5000*5000 + n_1000*1000 == Y_sum_money:
        print(n_10000, n_5000, n_1000)
        exit()

for n_10000 in range(min(int(Y_sum_money/10000), N_n_osatsu)+1): # 万札枚数。0枚からスタート
    is_answer(n_10000, 0, 0)
    rest_money = Y_sum_money - 10000*n_10000
    rest_n_osatsu = N_n_osatsu - n_10000
    if skip_search(rest_money, rest_n_osatsu):
        break

    for n_5000 in range(min(int(rest_money/5000 + 1), rest_n_osatsu)+1): # 万札枚数決定後に5000円の枚数を探索。5000円0枚からスタート
        is_answer(n_10000, n_5000, 0)
        rest_money = Y_sum_money - 10000*n_10000 - 5000*n_5000
        rest_n_osatsu = N_n_osatsu - n_10000 - n_5000
        if skip_search(rest_money, rest_n_osatsu):
            break
        n_1000 = int(rest_money/1000)
        is_answer(n_10000, n_5000, n_1000)

print("-1 -1 -1")

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int[][] days = new int[3][n];
    for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) {
      days[j][i] = s.nextInt();
    }

    System.out.println(bestVacation(days));
  }

  private static int bestVacation(int[][] days) {
    if (days.length == 0 || days[0].length == 0)
      return 0;

    int n = days[0].length;

    int[][] dp = new int[3][n + 1];

    int max = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 3; j++)
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[j][i + 1] = Math.max(dp[j][i + 1], dp[k][i] + days[j][i]);
        if (i == n - 1)
          max = Math.max(max, dp[j][i + 1]);
      }
    }

    return max;
  }
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> data(m);
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    for(int j = 0; j < x; j++){
      int y;
      cin >> y;
      data.at(y - 1) += 1; 
    }
  }
  int count = 0;
  for(auto x : data){
    if(x == n){
      count++;
    }
  }
  cout << count << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    int X, A, B;
    cin >> X >> A >> B;
    
    X -= A;
    int n = X / B;
    X -= n * B;
    
    cout << X << endl;
    return 0;
}


Measured memory_bytes: 256
*j, n = map(int, input().split())
j.sort()
a, b, c = j
count = 0
for y in range(n//b+1):
    for z in range((n-y*b)//c+1):
        if (n - b*y - c*z) % a == 0:
            count += 1
print(count)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <stack>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;

void printarray(int n, int a[])
{
    for (int i = 0; i < n; i++)
    {
        cout << a[i];
        /*if (i != n - 1)
            cout << " ";*/
    }
    cout << endl;
}

void printpairaraay(int n, pair<int, int> a[])
{
    int x, y;
    for (int i = 0; i < n; i++)
    {
        x = a[i].first;
        y = a[i].second;
        cout << x << " " << y << "\n";
    }
    cout << endl;
}

void swaprange(int b, int t, int e, int a[])
{
    for (int i = 0; i < e - b; i++)
    {
        swap(a[b + i], a[i + t]);
    }
}

int my_binarysearch(int n, int a[], int x)
{
    int ret = 0;
    if (distance(lower_bound(a, a + n, x), upper_bound(a, a + n, x)) != 0)
        ret = 1;
    return ret;
}

void printbit(unsigned int x)
{
    unsigned int b, y;
    
    b = 32;
    int a[b];
    y = pow(2, 31);
    cin >> x;

    for (int i = 0; i < b; i++)
    {
        if (x >= y)
        {
            a[i] = 1;
            x -= y;
        }
        else
            a[i] = 0;

        y = y >> 1;
    }
    printarray(b, a);
}

int main()
{	
  	const unsigned int max = 4294967295;
  	unsigned int x, y, z, w;
   	cin >> x;
	printbit(x);
  	w = x ^ 4294967295;
  	printbit(w);
  	y = x << 1;
 	printbit(y);
	z = x >> 1;
 	printbit(z);
    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<bool> a(4, true);
  int A, B;
  cin>>A>>B;
  a.at(A) = false;
  a.at(B) = false;
  for(int i=1; i<=3; i++){
    if(a.at(i)){
      cout<<i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s[0] != 'k' && s[s.size() - 1] != 'e') {
    	cout << "NO" << endl;
    	return 0;
    }
	else if (s[0] != 'k' && s[s.size() - 1] == 'e') {
			if (s.substr(s.size() - 7, 7) == "keyence") {
            	cout << "YES" << endl;
            	return 0;
            }
	}
	else if (s[0] == 'k' && s[s.size() - 1] != 'e') {
			if (s.substr(0, 7) == "keyence") {
            	cout << "YES" << endl;
            	return 0;
            }
	}
	else if (s[0] == 'k' && s[s.size() - 1] == 'e') {
		for (int i = 0; i < 8; i++) {
			for (int j = i; j < s.size(); j++) {
				if (s.substr(0, i) + s.substr(j, s.size() - j) == "keyence") {
                	cout << "YES" << endl;
                	return 0;
                }
                else if (s.substr(0, 7) == "keyence") {
            		cout << "YES" << endl;
            		return 0;
            	}
            	else if (s.substr(s.size() - 7, 7) == "keyence") {
            		cout << "YES" << endl;
            		return 0;
            	}
			}
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,c,sum=0,d;
  d = scanf("%d %d %d",&a,&b,&c);
  sum = a + b;
  
  if(sum<c){
    printf("No\n");
  }else{
    printf("Yes\n");
  }

  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

N, M = map(int, input().split())

D = {} # 親；子
T = {}
for i in range(1, N+1):
    D[i] = []
    T[i] = 0

for i in range(1,M+1):
    A, B = map(int, input().split())
    D[A].append(B)
    D[B].append(A)

parent = [1]


while len(parent) > 0:
    child = []
    for p in parent:
        for c in D[p]:
            if T[c] != 0: continue
            T[c] = p
            child.append(c)
    parent = child

for i in range(2, N+1):
    if T[i] == 0:
        print('No')
        exit()

print('Yes')
for i in range(2, N+1):
    print(T[i])
    




Measured memory_bytes: 45744
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


L, R = Is()
mod = 2019

n = min(R-L+1, 2019)
li = [-1]*n

tmp = L % 2019
for i in range(n):
    if tmp + i == 2019:
        print("0")
        exit()
    li[i] = tmp + i

ans = INF
for x, y in combinations(range(n), 2):
    ans = min(ans, li[x]*li[y]%mod)

print(ans)


Measured memory_bytes: 41068
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d;
  cin>>n>>d;

  int num=0;
  int ans=0;
  while(1){
    num+=d;
    num++;
    num+=d;
    if(n<=num){
      cout<<ans+1<<endl;
      break;
    }else{
      ans++;
    }
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
a = [format(i,'b') for i in A]
ans = 0
mod = 10**9+7
for i in range(60):
  cnt = 0
  for v in a:
    if len(v)<i+1:
      continue
    if v[-1-i]=='1':
      cnt += 1
  cnt = cnt*(n-cnt)%mod
  ans += cnt*(2**i)%mod
print(ans%mod)

Measured memory_bytes: 154824
#https://atcoder.jp/contests/abc059/tasks/arc072_a

n = int(input())
l = list(map(int, input().split()))
cas1 = [0, 0]
cas2 = [0, 0]
def plus(index, cas):
    cost = cas[0]
    sum = cas[1]
    if (sum + l[index]) <= 0:
        return [cost + abs(l[index]+sum-1), 1]
    else:
        return [cost, sum + l[index]]
def minus(index, cas):
    cost = cas[0]
    sum = cas[1]
    if (sum + l[index]) >= 0:
        return [cost + abs(l[index]+sum+1), -1]
    else:
        return [cost, sum + l[index]]

for i in range(n):
    if i%2 == 0:
        cas1 = plus(i, cas1)
        cas2 = minus(i, cas2)
    else:
        cas1 = minus(i, cas1)
        cas2 = plus(i, cas2)

print(min(cas1[0], cas2[0]))


Measured memory_bytes: 14464
#include<iostream>
using namespace std;
int main(){
    int h, w;
    cin >> h >> w;
    while(h!=0 || w!=0){
        int i, j;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                if(i==0 || j==0 || i==h-1 || j==w-1){
                    cout << "#" ;
                }
                else cout << "." ;
                }
                cout << endl ;
            }
            cout << endl ;
            cin >> h >> w ;
        }
    }



Measured memory_bytes: 3080
#include<iostream>//TLE
using namespace std;

struct node
{long long v; struct node *next;};

void visit(long long k, struct node *z, struct node **adj, long long *pid, long long val[], long long component_num[], long long num){
    struct node *t;
    val[k] = -1;
    *pid += 1;
    component_num[k] = num;
    for(t = adj[k]; t != z; t = t -> next){
        if(val[t -> v] == 0) visit(t -> v, z, adj, pid, val, component_num, num);
    }
}
void search(long long V, struct node *z, struct node **adj,  long long val[], long long component_num[], long long component_size[]){
    long long k;
    long long id;
    long long num = 0;
    for(k = 1; k <= V; k++) val[k] = 0;
    for(k = 1; k <= V; k++){
        if(val[k] == 0){
            id = 0;
            num++;
            visit(k, z, adj, &id, val, component_num, num);
            component_size[num] = id;
        }
    }
}

int main(){
    //nyuryoku
    long long N, M, K;
    cin >> N >> M >> K;
    long long A[M + 1], B[M + 1];
    long long C[K + 1], D[K + 1];
    for(long long i = 1; i <= M; i++){
        cin >> A[i] >> B[i];
    }
    for(long long j = 1; j <= K; j++){
        cin >> C[j] >> D[j];
    }

    //edge_size
    long long friend_size[N + 1];
    long long block_size[N + 1];
    for(long long k = 1; k <= N; k++){
        friend_size[k] = 0;
        block_size[k] = 0;
    }

    //adjacency list representation_friend
    struct node *t;
    struct node *adj_friend[N + 1], *z_friend;
    z_friend = new node;
    z_friend -> next = z_friend;
    for(long long k = 1; k <= N; k++) adj_friend[k] = z_friend;
    for(long long i = 1; i <= M; i++){
        t = new node;
        t -> v = A[i];
        t -> next = adj_friend[B[i]];
        adj_friend[B[i]] = t;
        t = new node;
        t -> v = B[i];
        t -> next = adj_friend[A[i]];
        adj_friend[A[i]] = t;
        // edge
        friend_size[A[i]] += 1;
        friend_size[B[i]] += 1;
    }

    //dfs
    long long val_friend[N + 1];
    long long component_num_friend[N + 1];
    long long component_size_friend[N + 1];//index is component_num
    search(N, z_friend, adj_friend, val_friend, component_num_friend, component_size_friend);

    //adjacency list representation_block
    struct node *adj_block[N + 1], *z_block;
    z_block = new node;
    z_block -> next = z_block;
    for(long long k = 1; k <= N; k++) adj_block[k] = z_block;
    for(long long j = 1; j <= K; j++){
        t = new node;
        t -> v = C[j];
        t -> next = adj_block[D[j]];
        adj_block[D[j]] = t;
        t = new node;
        t -> v = D[j];
        t -> next = adj_block[C[j]];
        adj_block[C[j]] = t;
        // edge
        if(component_num_friend[C[j]] == component_num_friend[D[j]]){
            block_size[C[j]] += 1;
            block_size[D[j]] += 1;
        }
    }

    for(long long k = 1; k <= N; k++){
        cout << component_size_friend[component_num_friend[k]] -1 - friend_size[k] - block_size[k] << " ";
    }
    cout << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 22648
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	string in;
	cin >> in;
	if(in=="A")
		cout << "T" << endl;	
	if(in=="T")
		cout << "A" << endl;
	if(in=="G")
		cout << "C" << endl;
	if(in=="C")
		cout << "G" << endl;



}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

const string ans[]={"First","Second"};
vector<int> A;
int M=0x7fffffff, D[2][100001];

int solve(int t, int c)
{
	if(c<M) return !t;
	if(D[t][c]!=-1) return D[t][c];
	if(t) {
		D[t][c]=0;
		for(auto a: A) {
			if(c>=a) D[t][c]=max(D[t][c],solve(!t,c-a));
		}
	}
	else {
		D[t][c]=1;
		for(auto a: A) {
			if(c>=a) D[t][c]=min(D[t][c],solve(!t,c-a));
		}
	}
	return D[t][c];
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, K;
	cin>>N>>K;
	A.resize(N);
	for(int i=0;i<N;i++) {
		cin>>A[i];
		M=min(M,A[i]);
	}
	memset(D,-1,sizeof(D));
	cout<<ans[solve(0,K)]<<'\n';
	return 0;
}

Measured memory_bytes: 7296
#include<stdio.h>


int main(){
	int A[3],N,i;
	/*
	printf("3辺の値を入力してください例:3 4 5\n");
	scanf("%d%d%d",&A[0],&A[1],&A[2]);
	*/

	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d%d%d",&A[0],&A[1],&A[2]);

		/*
		三角形であるかどうかの判定
		if(A[0]+A[1] < A[2] ||A[1]+A[2] < A[0] ||A[2]+A[0] < A[1] ){
			printf("NO");
			return 0;
		}
		*/

		//三平方で直角三角形か確認
		if(A[0]*A[0] == A[1]*A[1] + A[2]*A[2] || A[1]*A[1] == A[2]*A[2] + A[0]*A[0]||A[2]*A[2] == A[0]*A[0] + A[1]*A[1]) 
			printf("YES\n");
		else
			printf("NO\n");
	}
    return 0;
}

Measured memory_bytes: 580
let rec f l tup =
	match l with
	|[] -> tup
	|x::xs -> let (a,b,c) = tup in f xs ((if x < a then x else a),(if x > b then x else b),x+c);;

let rec map f l =
	match l with
	|[] -> []
	|x::xs -> (f x)::(map f xs);;

let num = Scanf.sscanf(read_line()) "%d" (fun x -> x)
in
let rec make l n =
	match n with
	|0 -> l
	|_ -> make ((Scanf.scanf " %d" (fun x -> x))::l) (n-1)
in
let (a,b,c) = f (make [] num) (100000000,-100000000,0)
in
Printf.printf "%d %d %d\n" a b c;;



Measured memory_bytes: 4644
#include <bits/stdc++.h>
#include <random>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pll pair<ll,ll>
#define ld double
#define pld pair<ld,ld>
#define pii pair<int,int>
#define sqr(a) ((a)*(a))
#define all(v) v.begin(),v.end()

using namespace std;
//using namespace __gnu_pbds;

ll MOD = 998244353;
const ll INF = 1e18;
const ld E = 1e-18;
const ld PI=acos(-1);
mt19937_64 rnd(time(0));
ll p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD, md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;

//using ord_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

ll n, m, T, a[1000001];

ll binpow(ll h, ll r, ll md = MOD)
{
    ll l = 1;
    while (r)
    {
        if (r & 1) l *= h, l%=md;
        h *= h;
        h %= md;
        r /= 2;
    }
    return l;
}

ll gcd(ll x, ll y)
{
    if (x < y) swap(x, y);
    while (x && y)
    {
        x %= y;
        swap(x, y);
    }
    return x + y;
}

ll check(int h)
{
    ll j=0;
    while (h)
    {
        ll x=h, kl=0;
        while (x)
        {
            kl+=x&1;
            x/=2;
        }
        h%=kl;
        j++;
    }
    return j;
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("capitals.in","r",stdin);
    //freopen("capitals.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    string s;
    cin >> s;
    s=' '+s;
    ll kl=0;
    for (int i = 1; i <= n; i++)
    {
        kl+=s[i]-48;
    }
    ll k1=0, k2=0;
    for (int i = n, j = 0; i > 0; i--, j++)
    {
        if (s[i]=='1')
        {
            if (kl>1) k1=(k1+binpow(2,j,kl-1))%(kl-1);
            k2=(k2+binpow(2,j,kl+1))%(kl+1);
        }
    }
    for (int i = 1, j = n-1; i <= n; i++, j--)
    {
        if (s[i]=='1')
        {
            if (kl==1)
            {
                cout << "0\n";
                continue;
            }
            ll p=k1;
            //cout << binpow(2,j,kl-1) << " " << kl-1 << "\n";
            p-=binpow(2,j,kl-1);
            if (p<0) p+=kl-1;
            cout << 1+check(p) << "\n";
        }else
        {
            ll p=k2;
            p=(p+binpow(2,j,kl+1))%(kl+1);
            cout << 1+check(p) << "\n";
        }
    }
    return 0;
}

/*
3
4 2
1 1
1 0
3 2
2 2

3 1
1 1
1 0
3 2

3 2
1 1
1 0
3 2
*/


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    string s, t, u;
    int n, a, b;
    cin >> s >> n;
    rep(i, n)
    {
        cin >> t >> a >> b;
        if (t == "print")
        {
            cout << s.substr(a, b - a + 1) << endl;
        }
        else if (t == "replace")
        {
            string u;
            cin >> u;
            rep2(i, a, b + 1)
            {
                s[i] = u[i - a];
            }
        }
        else
        {
            u = s.substr(a, b - a + 1);
            reverse(all(u));

            rep2(i, a, b + 1)
            {
                s[i] = u[i - a];
            }
        }
    }
    return 0;
}



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

#define MOD 1000000007

//var 
long long h,w,dp[1001][1001];
bool wall[1001][1001], v[1001][1001];
char ca;

void dfs(int x, int y){
	v[x][y] = 1;
	if(wall[x][y]){dp[x][y] = 0; return;}
	if(x==1 && y==1)return;
	if(x-1>=1){
		if(!v[x-1][y])dfs(x-1,y);
		dp[x][y] += dp[x-1][y]; dp[x][y] += MOD; dp[x][y] %= MOD;
	}
	if(y-1>=1){
		if(!v[x][y-1])dfs(x,y-1);
		dp[x][y] += dp[x][y-1]; dp[x][y] += MOD; dp[x][y] %= MOD;
	}
}

int main(){
	cin >> h >> w;
	for(int i = 1; i<=h; i++)for(int j = 1; j<=w; j++){
		cin >> ca;
		wall[i][j] = (ca == '#');
	}dp[1][1] = 1;
	dfs(h,w);
	cout << dp[h][w]%MOD << endl;
}

Measured memory_bytes: 10112