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

int isprime(int n) {
	int i;
    for(int i = 2; i * i <= n; i++) {
        if(n % i == 0) return 0;
    }
    return 1; 
}

int main() {
    int i, k, v,an1,an2,suu;
    int MAX_V = 10000;
    int prime[MAX_V+1];
    for(i = 0; i <= MAX_V; i++) {
        prime[i] = 1;
    }
    for(i = 2; i*i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0;   
            } 
        }
    }
   while(1){
        scanf("%d",&suu);
        if(suu != 0){
            for(k=2;k<=suu;k++){
            	if(prime[k-2]==1 && prime[k]==1){
        	    	an1=k-2;
        	    	an2=k;
            	}
            }
            printf("%d %d\n",an1,an2);
        }
        else{
    	    break;
        }
    }
    return 0; 
}

Measured memory_bytes: 1068
#include <stdio.h>
#define Max 100

int main(){
  int i,j,k,l,n,q;
  int m[Max][Max], r[Max], c[Max];

  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++){
    scanf("%d%d",&r[i],&c[i]);
  }
  c[0]=r[1];

  for(i = 1 ; i <= n ; i++){
    m[i][i]=0;
  }

  for(i = 2 ; i <= n ; i++){
    for(j = 1 ; j <= n-i+1 ; j++){
      l = j+i-1;
      for(k = j ; k < l ; k++){
        q = m[j][k] + m[k+1][l] + c[j-1] * c[k] * c[l];
        if(k == j){
          m[j][l] = q;
        }
        else if(m[j][l] > q){
          m[j][l] = q;
        }
      }
    }
  }

  printf("%d\n",m[1][n]);

  return 0;
}



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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	long long h, n, a, z = 0;
	cin >> h;
	cin >> n;
	for(long long i = 0; i < n; ++i){
		cin >> a;
		z += a;
	}
	if(z >= h) cout << "Yes";
	else cout << "No";

	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
	private static void solveTC(int __) {
		
		/* For Google */
//		ans.append("Case #").append(__).append(": ");

//		code start
		
		int n=scn.nextInt();
		HashSet<String> set=new HashSet<>();
		while (n-->0){
			set.add(scn.next());
		}
		
		print(set.size());

//		code end
		
//		ans.append("\n");
	}
	
	static void print(Object obj) {
		ans.append(obj.toString());
	}
	
	public static void main(String[] args) {
		
		scn = new Scanner();
//		int t = scn.nextInt();
		int t = 1;
		for (int i = 1; i <= t; i++) {
			ans = new StringBuilder();
			solveTC(i);
			System.out.print(ans);
		}
		
	}
	
	static Scanner scn;
	static StringBuilder ans;
	
	//Fast Scanner
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;
		
		public Scanner() {
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}
		
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
		
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
		
		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextInt();
			}
			return array;
		}
		
		Integer[] nextIntegerArray(int n) {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextInt();
			}
			return array;
		}
		
		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}
			return array;
		}
		
		String[] nextStringArray() {
			return nextLine().split(" ");
		}
		
		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++) {
				array[i] = next();
			}
			return array;
		}
	}
}

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

int main() {
    ll N,Y;
    cin >> N >> Y;
    
    rep2(i,0,N+1){
        rep2(j,0,N-i+1){
            if( i*10000 + 5000*j  + 1000*(N-i-j)== Y ){
                cout << i << " " << j << " "<< N-i-j << endl;
                return 0;
            }
        }
    }
    
    cout << -1 << " " << -1 << " "<< -1 << endl;
    return 0;
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int64_t i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int64_t i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const ll md = 1000000007;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n, k;
    cin >> n >> k;
    VI V(n);
    REP(i, n) cin >> V[i];
    sort(all(V));
    int ans = 0;
   	REP(i, k) {
   		ans += V[i];
   	}
   	cout << ans << endl;

}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int dp[4002][4002]={};
int main() {
  string s,t;
  while( cin >> s >> t) {
    for(int i=0;i<=s.size();i++)
      for(int j=0;j<=t.size();j++)dp[i][j] = 0;
  int ans   = 0;
  for(int i=0;i<s.size();i++)
    for(int j=0;j<t.size();j++){
      if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
      ans = max(ans,dp[i+1][j+1]);
    }
  cout << ans <<endl;
  }
  return 0;
}

Measured memory_bytes: 63756
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int h,w,k; cin>>h>>w>>k;
    vector<string> s(h);
    rep(i,h) cin>>s[i];

    int x = h+w;

    auto calc = [&](const vector<int> &tate, const vector<int> &yoko) -> int {
        vector<string> t(s);
        for (auto &&e: tate) {
            rep(j,w) t[e][j] = '$';
        }
        for (auto &&e: yoko) {
            rep(i,h) t[i][e] = '$';
        }
        int ret = 0;
        rep(i,h) rep(j,w) if (t[i][j] == '#') ret++;
        return ret;
    };

    int ans = 0;
    for (int bit = 0; bit < (1<<x); ++bit) {
        int tmp = 0;
        vector<int> tate, yoko;
        rep(i,x) {
            if (bit & (1<<i)) {
                if (i < h) tate.push_back(i);
                else yoko.push_back(i-h);
            }
        }
        if (calc(tate, yoko) == k) ans++;
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3584
N = int(input())
AB = sorted([[int(_) for _ in input().split()] for _ in range(N)],
            key=lambda x: x[1],
            reverse=True)
CD = sorted([[int(_) for _ in input().split()] for _ in range(N)])
 
for i in range(N):
    p = -1
    for j in range(len(AB)):
        if AB[j][0] < CD[i][0] and AB[j][1] < CD[i][1]:
            p = j
            break
    if p > -1:
        AB.pop(p)
print(N - len(AB))

Measured memory_bytes: 3064
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        boolean yymm = false;
        boolean mmyy = false;
        String ab = s.substring(0, 2);
        String cd = s.substring(2);
        Set<String> month = new HashSet<>();
        month.add("01");
        month.add("02");
        month.add("03");
        month.add("04");
        month.add("05");
        month.add("06");
        month.add("07");
        month.add("08");
        month.add("09");
        month.add("10");
        month.add("11");
        month.add("12");
        if (month.contains(ab)) {
            mmyy = true;
        }
        if (month.contains(cd)) {
            yymm = true;
        }
        if (mmyy == true && yymm == true) {
            System.out.println("AMBIGUOUS");
        } else if (mmyy == true) {
            System.out.println("MMYY");
        } else if (yymm == true) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }



    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
   int N;
   cin >> N;
   vector<int> d(N);
 
   for(int i =0; i<N; i++){
       cin >> d[i];
   }
     sort(d.begin(),d.end());
    int count =1;
    for(int i =1; i<N; i++){
       if(d[i] != d[i-1]){
           count++;
       }
   }
   cout << count << endl;
}

Measured memory_bytes: 256
def main():
  n,k = [int(x) for x in input().split()]
  a = [int(x)-1 for x in input().split()]
  
  visited_at = [-1] * n
  visited_at[0] = 0
  x = 0
  step = 0
  warped = False
  while k > 0:
    #print("remain", k, "step", step, "at", x+1)
#    if k <= 1:
#      break
    y = a[x]
    step += 1
    k -= 1
    if not warped and visited_at[y] >= 0:
      cycle = step - visited_at[y]
      #print("cycle", cycle)
      step += int(k / cycle)
      k = k % cycle
      x = y
      warped = True
    else:
      visited_at[y] = step
      x = y
  print(x+1)
main()

Measured memory_bytes: 32324
#include <stdio.h>

int gcd(int, int);

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d\n", gcd(x, y));
    return 0;
}


int gcd(int x, int y)
{
    int r = x % y;
    if (r == 0) {
        return y;
    } else {
      return gcd(y, r);
    }
}





Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s, t;
    cin >> s >> t;
    int n = sz(s);
    int ans = 0;
    REP(i, n) if (s[i] != t[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 int n;
 cin>>n;
 string s;
 cin>>s;
 int k;
 cin>>k;
 k--;
 char c=s[k];
 for(char& x:s){
  if(x!=c) x='*';
 }
 cout<<s<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll dp[100010][4];

void solve(){

    string s;
    cin >> s;
    ll n = s.length();
    dp[n][3]=1;
    rep(j,3){
        dp[n][j]=0;
    }
    for(ll i=n-1; i>=0; i--){
        dp[i][3]=(dp[i+1][3]*(s[i]=='?'? 3:1))%MOD;
    }
    for(ll i=n-1; i>=0; i--){
        ll m1,m2;
        if(s[i]=='?') {
            m1 = 3;
            m2 = 1;
        }
        else if(s[i]=='C') {
            m1 = 1;
            m2 = 1;
        }
        else {
            m1 = 1;
            m2 = 0;
        }
        dp[i][2]=(m1 * dp[i+1][2] + m2 * dp[i+1][3])%MOD;
    }
    for(ll i=n-1; i>=0; i--){
        ll m1,m2;
        if(s[i]=='?') {
            m1 = 3;
            m2 = 1;
        }
        else if(s[i]=='B') {
            m1 = 1;
            m2 = 1;
        }
        else {
            m1 = 1;
            m2 = 0;
        }
        dp[i][1]=(m1 * dp[i+1][1] + m2 * dp[i+1][2])%MOD;
    }
    for(ll i=n-1; i>=0; i--){
        ll m1,m2;
        if(s[i]=='?') {
            m1 = 3;
            m2 = 1;
        }
        else if(s[i]=='A') {
            m1 = 1;
            m2 = 1;
        }
        else {
            m1 = 1;
            m2 = 0;
        }
        dp[i][0]=(m1 * dp[i+1][0] + m2 * dp[i+1][1])%MOD;
    }

    /*
    rep(j,4){
        rep(i,n){
            cout << dp[i][3-j] << " ";
        }
        cout << endl;
    }
    */
    
    cout << dp[0][0] << endl;

}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0); 
ll N;
ll cnt[10000001];
ll ans;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> N;
    for(int i = 1; i <= N; i++)
        for(int j = i; j <= N; j += i)
            cnt[j]++;
    rep2(i,1,N) ans += i * cnt[i];
    cout << ans;
	return 0;
}


Measured memory_bytes: 81736
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second 
#define mod 1000000007

using namespace std;

int n, dp[2][200100], x, y;
int viz[200100];
vector<int> v[200100];

void dfs(int x) {
    viz[x] = 1;

    ll prod = 1;
    ll sum = 1;
    for (int y : v[x]) 
        if (!viz[y]) {
            dfs(y);
            prod *= 1ll * ((dp[1][y] + dp[0][y]) % mod);
            prod %= mod;

            sum *= 1ll * dp[0][y];
            sum %= mod;
        }

    dp[0][x] = prod;
    dp[1][x] = sum; 
}

int main() {
    // ifstream cin("tst.in");
    // ofstream cout("tst.out");
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> n;
    if (n == 1)
        return cout << 2, 0;

    for (int i = 1; i < n; i++) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    int p = -1;
    for (int i = 1; i <= n; i++)
        if ((int) v[i].size() == 1) {
            p = i;
            break;
        }

    dfs(p);
    cout << (dp[0][p] + dp[1][p]) % mod;

    return 0;
}

Measured memory_bytes: 14208
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] array = br.readLine().split(" ");
        int a = Integer.parseInt(array[0]);
        int b = Integer.parseInt(array[1]);
		System.out.println((a*b)+" "+(a+b+a+b));
	}
}

Measured memory_bytes: 16892
#include <iostream>

using namespace std;

int main(){
  int a, b, c;
  
  cin >> a >> b >> c;
  
  if(a+b ==c || a+c == b || b+c == a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
int main(){

  char s1[11],s2[11],s3[11],x,y,z;

  scanf("%s %s %s",s1,s2,s3);

  x = toupper(s1[0]);
  y = toupper(s2[0]);
  z = toupper(s3[0]);

  printf("%c%c%c\n",x,y,z);

  return 0;
}

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

using namespace std;


int main(){
   int n , x ;
   cin >> n >> x ;
  
  int ans =2,res = n;
  
  if(x == 1 || x == 2*n-1){
    cout << "No" << endl;
    
    return 0;
  }
   
  else{
    if(x < n){
      cout << "Yes" << endl;
    for(int i=0;i<n-2;i++){
      if(i+ans != x){
      cout << i+ans << endl;
    }
      else{
        ans++;
        cout << i+ans << endl;
      }
    }
    cout << "1" << endl;
    cout <<  x << endl;
    cout << 2*n-1 << endl;
      
    for(int i=0;i<n-2;i++){
      cout << i+n+1 << endl;
    }
      
    }
    else{
      cout << "Yes" << endl;
      
      for(int i=0;i<n-2;i++){
     
      cout << i+2 << endl;
    
      }
      
    cout << "1" << endl;
    cout <<  x << endl;
    cout << 2*n-1 << endl;
      
    for(int i=0;i<n-2;i++){
      if(i+res != x){
      cout << i+res << endl;
    }
      else{
        res++;
        cout << i+res << endl;
      }
    }
    }
  }
}


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

struct N
{
    ll a,b;
    bool operator <(N f) const
    {
        return a<f.a;
    }
}t[100040];
ll n,m,tol;

int main()
{
    scanf("%lld%lld",&n,&m);
    for(int i=0;i<n;i++)
        scanf("%lld%lld",&t[i].a,&t[i].b);

    sort(t,t+n);
    tol=0;
    for(int i=0;i<n;i++)
    {
        if(m>t[i].b)
        {
            m-=t[i].b;
            tol+=(t[i].b*t[i].a);
        }
        else
        {
            tol+=(m*t[i].a);
            break;
        }
    }
    printf("%lld\n",tol);
    return 0;
}



Measured memory_bytes: 1792
import random
N, K = list(map(int, input("").split(" ")))
point = [i for i in range(1,N+1)]
pa=0
for i in point:
  p = 1/N
  while True:
    if i <= K-1:
      p *= 1/2
      i *= 2
    else:
      pa += p
      break
print(pa)

Measured memory_bytes: 7448
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <chrono>

using namespace std;
using ll = long long;

template<class T>
T GCD(T a, T b) {
	T c = max(a, b);
	T d = min(a, b);
	while (c%d != 0) {
		T t = d;
		d = c % d;
		c = t;
	}
	return d;
}

template<class T>
T LCM(T a, T b) {
	T c = max(a, b);
	T d = min(a, b);
	while (c%d != 0) {
		T t = d;
		d = c % d;
		c = t;
	}
	return a * b / d;
}

int main() {
	ll N, M;
	cin >> N >> M;
	string s, t;
	cin >> s;
	cin >> t;
	ll l = LCM<ll>(N, M);
	ll g = GCD<ll>(N, M);
	ll ng = static_cast<long long>(N/g);
	ll mg = static_cast<long long>(M/g);
	// ll gl = LCM<ll>(ng, mg);
	for (ll i = 0; i != g; ++i) {
		if (s[i*ng] != t[i*mg]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const long long MOD=1000000007;
const long double Pi=acos(-1);
long long nature(long long a){//絶対値を返す
  if(a>=0){return(a);}
  else{return(-1*a);}
}
ll mod_pow(ll x,ll y){//x^yを返す//計算量は0(log(y))
  ll tmp=x,res=1;
  while(y){
    if(y%2){res=res*tmp%MOD;}
    y>>=1;
    tmp=tmp*tmp%MOD;
  }
  return res;
}
int main(){
  #define int long long
  int N;
  int MOD=1000000007;
  cin>>N;
  int ans=0;
  if(N==1){cout<<0<<endl;}
  if(N==2){cout<<2<<endl;}
  if(N>=3){
    ans=mod_pow(10,N);
    ans-=mod_pow(9,N)-MOD;
    ans%=MOD;
    ans-=mod_pow(9,N)-MOD;
    ans%=MOD;
    ans+=mod_pow(8,N);
    ans%=MOD;
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3664
#include<stdio.h>
char p[110];
int main(){
    int i;
    scanf("%s",p);
    for(i=0;p[i];i++)if(p[i]=='C')break;
    for(i=i+1;p[i];i++)if(p[i]=='F')break;
    if(p[i]=='F')printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define _USE_MATH_DEFINES

int main()
{
    int n=0,ii=0,max_number=1,max_count=0,new_max_count=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++){

	ii=i;

	new_max_count=0;  // reset
	while(1){
	   
	    if(ii%2!=0)
		break;
	    
	    else{
		ii=ii/2;
		new_max_count++;
	    }

	}

	if(new_max_count>=max_count){
	    max_count=new_max_count;
	    max_number=i;
	}
    }
    printf("%d",max_number);

    return 0;
}





Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
#include <stdio.h>

int main(void){
  std::string s;
  std::cin >> s;
  if(s[2]==s[3] && s[4]==s[5]){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }
  return 0;
}

Measured memory_bytes: 3528
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // input
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        String ans = "";
        if (s.equals(t.substring(0, s.length()))) {
            ans = "Yes";
        }
        else {
            ans = "No";
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 35684
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
int main(){
  int N,M;
  cin>>N>>M;
  if(N >= M){
    cout<<0<<endl;
    return 0;
  }
  vector<int> X(M);
  for(int i=0;i<M;i++)
    cin>>X[i];
  sort(X.begin(),X.end());
  ll dist = X.back() - X.front();
  vector<int> D(M-1);
  for(int i=0;i<M-1;i++)
    D[i] = X[i + 1] - X[i];
    sort(D.begin(),D.end(),greater<int>());
  for(int i=0;i<N-1;i++){
    dist -= D[i];
    if(i == M-2)
    break;
  }
  cout<<dist<<endl;
  return 0;
}


Measured memory_bytes: 1024
def calc(lx,ly,rx,ry):
  if rx<0 or ry<0 or lx>rx or ly>ry:
    return 0
  ret=acum[ry*2*k+rx]
  if lx!=0:
    ret-=acum[ry*2*k+lx-1]
  if ly!=0:
    ret-=acum[(ly-1)*2*k+rx]
  if lx!=0 and ly!=0:
    ret+=acum[(ly-1)*2*k+lx-1]
  return ret

n,k=map(int,input().split())
board=[0]*(4*k*k)
acum=[0]*(4*k*k)
for _ in range(n):
  x,y,c=input().split()
  x,y=int(x)%(2*k),int(y)%(2*k)
  if c=='B':
    board[y*2*k+x]+=1
  if c=='W':
    y+=k
    y%=2*k
    board[y*2*k+x]+=1
for i in range(2*k):
  for j in range(2*k):
    acum[i*2*k+j]=board[i*2*k+j]
    if i!=0:
      acum[i*2*k+j]+=acum[(i-1)*2*k+j]
    if j!=0:
      acum[i*2*k+j]+=acum[i*2*k+j-1]
    if i!=0 and j!=0:
      acum[i*2*k+j]-=acum[(i-1)*2*k+j-1]
ans=0
for i in range(k):
  for j in range(k):
    tmp1=0
    lx,ly=i,j
    rx,ry=lx+k-1,ly+k-1
    #1個目のマス
    tmp1+=calc(lx,ly,rx,ry)
    #左上のマス
    tlx,tly=0,0
    trx,ttry=lx-1,ly-1
    tmp1+=calc(tlx,tly,trx,ttry)
    #右上のマス
    tlx,tly=rx+1,0
    trx,ttry=2*k-1,ly-1
    tmp1+=calc(tlx,tly,trx,ttry)
    #左下のマス
    tlx,tly=0,ry+1
    trx,ttry=lx-1,2*k-1
    tmp1+=calc(tlx,tly,trx,ttry)
    #右下のマス
    tlx,tly=rx+1,ry+1
    trx,ttry=2*k-1,2*k-1
    tmp1+=calc(tlx,tly,trx,ttry)
    tmp2=0
    #上のマス
    tlx,tly=lx,0
    trx,ttry=rx,ly-1
    tmp2+=calc(tlx,tly,trx,ttry)
    #左のマス
    tlx,tly=0,ly
    trx,ttry=lx-1,ry
    tmp2+=calc(tlx,tly,trx,ttry)
    #右のマス
    tlx,tly=rx+1,ly
    trx,ttry=2*k-1,ry
    tmp2+=calc(tlx,tly,trx,ttry)
    #下のマス
    tlx,tly=lx,ry+1
    trx,ttry=rx,2*k-1
    tmp2+=calc(tlx,tly,trx,ttry)
    ans=max(ans,tmp1,tmp2)
print(ans)

Measured memory_bytes: 138824
#include <bits/stdc++.h>
#define int long long
#define maxn 16
using namespace std;

int arr[maxn][maxn] = {};
int dp[1 << maxn], sum[1 << maxn] = {};
int n;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            cin >> arr[i][j];
        }
    }
    for(int S = 0; S < (1 << n); S++) {
        for(int j = 0; j < n; j++) {
            if(!(S & (1 << j))) continue;
            for(int k = j + 1; k < n; k++) {
                if(S & (1 << k)) {
                    sum[S] += arr[j][k];
                }
            }
        }
    }
    for(int S = 0; S < (1 << n); S++) {
        int x = S;
        dp[x] = sum[x];
        while(x) {
            x = (x - 1) & S;
            dp[S] = max(dp[S], dp[S ^ x] + sum[x]);
        }
    }
    cout << dp[(1 << n) - 1] << '\n';
    return 0;
}


Measured memory_bytes: 4676
#include <cstdio>
#include <vector>
using namespace std;

vector<int> l[10000];
int s[10000];
int n;

void unite(int x, int y){
    if(s[x]==s[y])return;

    int i,j,tmp;
    int sx = s[x];
    int sy = s[y];
    for(i=0;i<l[sy].size();i++){
        tmp = l[sy][i];
        s[tmp] = sx;
        l[sx].push_back(tmp);
    }
    l[sy].clear();
    return;
}

bool same(int x, int y){
    return s[x]==s[y];
}

int main(){
    int i,q,com,x,y;
    scanf("%d %d",&n,&q);
    for(i=0;i<n;i++){
        s[i]=i;
        l[i].push_back(i);
    }
    for(i=0;i<q;i++){
        scanf("%d %d %d",&com,&x,&y);
        if(com==0)unite(x,y);
        else{
            if(same(x,y))printf("1\n");
            else printf("0\n");
        }
    }
    return 0;
}



Measured memory_bytes: 59472
// AOJ 2400 "審判は君だ！" (ICPC模擬国内予選 2012 Problem B)
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        final int PENALTY_TIME = 1200; // 1回の誤答で加算される時間
        Scanner sc = new Scanner(System.in);
        
        while (true) {
            int t = sc.nextInt();
            int p = sc.nextInt();
            int r = sc.nextInt();
            if (t == 0) {
                break;
            }
            
            Team[] teamArray = new Team[t];
            for (int i = 0; i < teamArray.length; i++) {
                teamArray[i] = new Team(i + 1, p);
            }
            
            for (int i = 0; i < r; i++) {
                int tId = sc.nextInt();
                int pId = sc.nextInt();
                int time = sc.nextInt();
                String message = sc.next();
                
                if (message.equals("CORRECT")) {
                    teamArray[tId-1].ans++;
                    teamArray[tId-1].time += teamArray[tId-1].wrongAnswer[pId-1]
                                            * PENALTY_TIME + time;
                } else if (message.equals("WRONG")) {
                    teamArray[tId-1].wrongAnswer[pId-1]++;
                }
            }
            Arrays.sort(teamArray);
            for (int i = 0; i < teamArray.length; i++) {
                System.out.println(teamArray[i].id + " " + teamArray[i].ans + " " + teamArray[i].time);
            }
        }
    }
}

class Team implements Comparable<Team> {
    int id; // チーム番号
    int ans; // 正解数
    int time; // ペナルティ
    int[] wrongAnswer; // 各問題を間違えた回数
    
    Team(int id, int p) {
        this.id = id;
        this.ans = 0;
        this.time = 0;
        this.wrongAnswer = new int[p];
    }
    
    public int compareTo(Team o) {
        if (this.ans != o.ans) {
            return o.ans - this.ans;
        } else if (this.time != o.time) {
            return this.time - o.time;
        } else if (this.id != o.id) {
            return this.id - o.id;
        } else {
            // 問題の性質上、ここに来ることはないはず
            return 0;
        }
    }
}

Measured memory_bytes: 61968
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//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 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,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
unsigned long long euclidean_gcd(unsigned long long a, unsigned long long b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

unsigned long long lcd(unsigned long long n, unsigned long long m){
    unsigned long long g = euclidean_gcd(n, m);
    return n/g*m;
}

void solve(unsigned long long N, std::vector<unsigned long long> T){
    unsigned long long ans=1LL; //careful!!!!!
    REP(i, N){
        ans = lcd(ans, T[i]);
    }
    cout<<ans<<endl;
}

int main(){
    unsigned long long N;
    scanf("%lld",&N);
    std::vector<unsigned long long> T(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&T[i]);
    }
    solve(N, std::move(T));
    return 0;
}


Measured memory_bytes: 256
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    input += chunk;
});
process.stdin.on('end', function() {
    main(input)
});

function main(arg){
    var mountains = arg.split('\n');
    mountains = mountains.map(function(x){ return parseInt(x); })

    var topMountains = [];

    iterateTopMountains(function init(i){
        topMountains[i] = 0;
    })

    for(var i = 0; i < mountains.length; i += 1){
        var mountain = mountains[i];

        iterateTopMountains(function displace(rank){
            if(mountain > topMountains[rank]){
                topMountains.splice(rank, 0, mountain);
                return true;
            }
        })

    }

    iterateTopMountains(function show(i){
        console.log(topMountains[i]);
    })
}

function iterateTopMountains(func){
    var numTopMountains = 3;
    for(var i = 0; i < numTopMountains; i += 1){
        var needBreak = func(i);

        if(needBreak){ break; }
    }
}

Measured memory_bytes: 15732
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

int n, k, m1 = 0, m;
int p[200000];

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

	for (int i = 0; i < n; i++)
		cin >> p[i];

	for (int i = 0; i < k; i++)
		m1 += p[i];

	m = m1;

	for (int i = 0; i < n - k; i++) {
		m1 += p[k + i] - p[i];
		m = max(m, m1);
	}

	cout << setiosflags(ios::fixed|ios::showpoint)
		<< setprecision(10) << (double)(m + k) / 2 << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn = 3000 + 50;
const int mod = 1e9 + 7;
int a[20][20], n;
ll sum[1<<20], dp[1<<20];
int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            scanf("%d", &a[i][j]);
    for(int i = 1; i < (1<<n); i++)
        for(int j = 0; j < n; j++)
            if((1<<j) & i){
                sum[i] = sum[i^(1<<j)];
                for(int k = j+1; k < n; k++)if((1<<k) & i)
                    sum[i] += a[j][k];
                break;
            }
    for(int i = 1; i < (1<<n); i++)
        for(int j = i; j; j = (j-1)&i)
            dp[i] = max(dp[i], dp[i^j] + sum[j]);
    printf("%lld\n", dp[(1<<n)-1]);
    return 0;
}

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

// マクロ //
#define rep(v,times) for(int v = 0; v < (int)(times); v++)
#define req(v,first,endplus1) for(int v = first; v < (int)(endplus1); v++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#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 pii = pair<int, int>;
using vpii = vector<pii>;
using plili = pair<lint, lint>;
using vplili = vector<plili>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvli = vector<vli>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using mii = map<int, int>;
using mili = map<int, lint>;
using mci = map<char, int>;
using mcli = map<char, lint>;
using msi = map<string, int>;
using msli = map<string, lint>;


// 関数 //
template<class T, class Q> lint gcd_(T a, Q b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T, class Q> lint lcm_(T a, Q b) {
    return a * b / gcd_(a, b);
}

template<class T, class Q> double distance(T a, Q b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

template<class T, class Q> inline bool chmin(T& a, Q b) {
    if (a > b) { 
        a = b;
        return true; 
    }
    return false;
}

template<class T, class Q> inline bool chmax(T& a, Q b) {
    if (a < b) { 
        a = b; 
        return true; 
    }
    return false;
}

// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);
const int dx4[4] = { 1,0,-1,0 };
const int dy4[4] = { 0,1,0,-1 };
const int dx8[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy8[8] = { 0,1,1,1,0,-1,-1,-1 };

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
        
    int N;
    cin >> N;
    vi A(N);
    rep(i, N)cin >> A[i];
    int cnt = 0;
    for (int i = 0; i < N; i += 2) {
        if (A[i] % 2 == 1) cnt++;
    }
    cou(cnt);


}

Measured memory_bytes: 3640
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int mod_pow(int n, int k) {
    int res = 1;
    for(; k>0; k>>=1) {
        if(k & 1) (res *= n) %= MOD;
        (n *= n) %= MOD;
    }
    return res;
}

int comb[2010][2010];
int dp[2010][2010][2];

signed main() {
    int N, K; scanf("%lld%lld", &N, &K);
    for(int i=0; i<=N; i++) {
        comb[i][0] = 1;
        for(int j=1; j<=i; j++) {
            comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % MOD;
        }
    }

    int ans = 0;
    dp[N][0][0] = 1;
    for(int i=N; i>=1; i--) {
        for(int j=N; j>=0; j--) {
            int processed_num = N - i;
            int pending_num = j;
            if(processed_num - pending_num == K-1) {
                (ans += dp[i][j][0] + dp[i][j][1]) %= MOD;
                continue;
            }
            
            // 今見たものをそのまま使う
            (dp[i-1][j][0] += dp[i][j][0] + dp[i][j][1]) %= MOD;

            // 今見たものをためる
            (dp[i-1][j+1][1] += dp[i][j][0] + dp[i][j][1]) %= MOD;

            // ためていたものを使う
            if(j > 0) (dp[i][j-1][0] += dp[i][j][0]) %= MOD;
        }
    }

    /*
    int M = N - K;
    dp2[0][M] = 1;
    for(int len=M; len>=1; len--) {
        int used = M - len;
        for(int l=0; l<M-len+1; l++) {
            int r = l + len;
            // fprintf(stderr, "dp2[%lld][%lld] = %lld\n", l, r, dp2[l][r]);
            (dp2[l+1][r] += dp2[l][r]) %= MOD;
            (dp2[l][r-1] += dp2[l][r]) %= MOD;
        }
    }
    */
    /*
    int ans = 0;
    for(int i=0; i<M; i++) {
        (ans += dp2[i][i+1]) %= MOD;
    }
    */
    // fprintf(stderr, "ans = %lld\n", ans);
    /*
    for(int i=1; i<=N; i++) {
        fprintf(stderr, "i = %lld, comb = %lld, rec = %lld\n", i, comb[N-1][i-1], rec[i]);
        (ans += comb[N-1][i-1] * rec[i]) %= MOD;
    }
    */
    // (ans *= dp[N-1][K-1]) %= MOD;
    (ans *= mod_pow(2, N - K - 1)) %= MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 94848
S = input()
for i in range(1,len(S)+1):
    if(i % 2 == 1):
        if(S[i-1] == "R" or S[i-1] == "U" or S[i-1] == "D"):
            continue
        else:
            print("No")
            exit()
    else:
        if(S[i-1] == "L" or S[i-1] == "U" or S[i-1] == "D"):
            continue
        else:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 9036
def main():


   N,M,X = map(int,input().split())
   tollList = list(map(int,input().split()))
   leftToll = [i for i in tollList if i < X]
   rightToll = [i for i in tollList if i > X]
   print(min(len(leftToll),len(rightToll)))




if __name__== "__main__":
    main() 






Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
 
using namespace std;
 
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
using ll = long long;
using P = pair<int,int>;

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

  if(a+b >= c) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main(){
    ll n;
    cin>>n;
    vector<ll> a(2*n);
    for(ll i=0;i<2*n;++i){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    ll ans=0;
    for(ll i=0;i<2*n;++i){
        if(i%2==1){
            continue;
        }
        ans+=a[i];
    }
    cout<<ans<<endl;

    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,long double> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

string s;

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

	cin>>s;
	REP(i,s.size()) {
		cout<<s[i];
		if(i==3) cout<<' ';
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		for(int i = 1; i <= n; i++){
		    if(i%2 == 0) continue;
		    int cnt = 0;
		    for(int j = 1; j <= i; j++){
		        if(i%j == 0) cnt++;
		    }
		    if(cnt == 8) result++;
		}
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

int main(){
  int N,i,j,A[100],minj,p=0,L;

  scanf("%d",&N);

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

  for(i=0;i<N-1;i++){
    minj=i;
    for(j=i;j<N-1;j++){
      if(A[minj]>A[j+1]){
	minj=j+1;
      }
    }
    if(minj!=i){
      p++;
      L=A[i];
      A[i]=A[minj];
      A[minj]=L;
    }
  }
  for(i=0;i<N;i++){
    if(i==N-1) printf("%d",A[i]);
    else printf("%d ",A[i]);
    
  }
  printf("\n");
  printf("%d",p);
  printf("\n");
  
  return 0;
}
    



Measured memory_bytes: 2080
# https://atcoder.jp/contests/keyence2020/tasks/keyence2020_a


def main():
    h = int(input())
    w = int(input())
    t = int(input())
    longer = max(h, w)
    shorter = min(h, w)
    num = t // longer
    if num * longer < t:
        num += 1
    print(num)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)
const ll mod = 1e9+7;


class union_find {
public:
vector<int> par,rank,lsize;
union_find(int n): par(n),rank(n),lsize(n){
   for (int i=0;i < n;i++){
      par[i]=i;
      rank[i]=0;
      lsize[i]=1;
   }
}

int find(int x){
   if (par[x]==x){
      return x;
   }
   else{
      return par[x] = find(par[x]); 
   }
}

void unite(int x ,int y){
   x=find(x);
   y=find(y);
   if (x==y) return;
   if (rank[x] < rank[y]){
      lsize[y] += lsize[x];
      lsize[x] = -1;
      par[x] = y;
   }else{
      lsize[x] += lsize[y];
      lsize[y] = -1;
      par[y]=x;
      if (rank[x]==rank[y]) rank[x]++;
   }   
}

bool same(int x, int y){
   return find(x) == find(y);
}

int size(int x){
   if (lsize[x] == -1){
      x=find(x);
   }
   return lsize[x];
}
};


int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> edges(m);
  rep(i,m){
    int x,y;
    cin >> x >> y;
    --x;--y;
    edges[i] = {x,y};
  }
  int ans = 0;
  for (int i = 0; i < m;i++){
    union_find tree(n);
    for (int j = 0; j < m;j++){
      if (i != j) tree.unite(edges[j].first,edges[j].second); 
    }
    if (tree.size(0) != n) ans++;
  }
  cout << ans << endl;
  
  return 0;
   

}


Measured memory_bytes: 3608
def main():
    N, x = map(int, input().split())
    A = list(map(int, input().split()))
    Acount = sum(A)
    if A[0] > x:
        A[0] = x
    for i in range(N-1):
        tmp = A[i] + A[i+1]
        if tmp > x:
            A[i+1] -= tmp - x
    ans = Acount - sum(A)
    print(ans)

if __name__ == "__main__":
    main()


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

int main(){
	int n, min, max, tmp;
	long int sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> tmp;
		if (i == 0){
			min = tmp;
			max = tmp;
		} else {
			if (tmp < min){
				min = tmp;
			}
			if (tmp > max){
				max = tmp;
			}
		}
		sum += tmp;
	}
	cout << min << " " << max << " " << sum << endl;
}

Measured memory_bytes: 3092
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();

    if(k<=a){
      System.out.println(1*k);
    }else if(a<k && k<=b){
      System.out.println(1*k);
    }else{
      int x = (-1)*(k-a-b);
      System.out.println(a+x);
    }
  }
}


Measured memory_bytes: 35788
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 2e5+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


void solve(){
    int n; cin>>n;
    vector<int> a(n);
    int x = 0;
    For(i, 0, n){
        cin>>a[i];
        x = x^a[i];
    }
    For(i, 0, n){
        int v = x^a[i];
        cout<<v<<" ";
    }
}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 4728